From 8891fd5acbe441d24a1734aa144f3f3dca075620 Mon Sep 17 00:00:00 2001 From: Kai Sasaki Date: Sun, 14 Apr 2024 19:52:03 +0900 Subject: [PATCH 01/10] [mlir][complex] Fastmath flag support for complex.tanh (#88571) --- .../ComplexToStandard/ComplexToStandard.cpp | 14 ++++++++------ .../convert-to-standard.mlir | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp index 0664b053fc9e67..49eb575212ffc1 100644 --- a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp +++ b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp @@ -973,6 +973,7 @@ struct TanhOpConversion : public OpConversionPattern { auto loc = op.getLoc(); auto type = cast(adaptor.getComplex().getType()); auto elementType = cast(type.getElementType()); + arith::FastMathFlagsAttr fmf = op.getFastMathFlagsAttr(); // The hyperbolic tangent for complex number can be calculated as follows. // tanh(x + i * y) = (tanh(x) + i * tan(y)) / (1 + tanh(x) * tan(y)) @@ -981,17 +982,18 @@ struct TanhOpConversion : public OpConversionPattern { rewriter.create(loc, elementType, adaptor.getComplex()); Value imag = rewriter.create(loc, elementType, adaptor.getComplex()); - Value tanhA = rewriter.create(loc, real); - Value cosB = rewriter.create(loc, imag); - Value sinB = rewriter.create(loc, imag); - Value tanB = rewriter.create(loc, sinB, cosB); + Value tanhA = rewriter.create(loc, real, fmf); + Value cosB = rewriter.create(loc, imag, fmf); + Value sinB = rewriter.create(loc, imag, fmf); + Value tanB = rewriter.create(loc, sinB, cosB, fmf); Value numerator = rewriter.create(loc, type, tanhA, tanB); Value one = rewriter.create( loc, elementType, rewriter.getFloatAttr(elementType, 1)); - Value mul = rewriter.create(loc, tanhA, tanB); + Value mul = rewriter.create(loc, tanhA, tanB, fmf); Value denominator = rewriter.create(loc, type, one, mul); - rewriter.replaceOpWithNewOp(op, numerator, denominator); + rewriter.replaceOpWithNewOp(op, numerator, denominator, + fmf); return success(); } }; diff --git a/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir b/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir index b22c1acacaea18..e0e7cdadd317d2 100644 --- a/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir +++ b/mlir/test/Conversion/ComplexToStandard/convert-to-standard.mlir @@ -2085,3 +2085,22 @@ func.func @complex_tan_with_fmf(%arg: complex) -> complex { // CHECK: %[[RESULT:.*]] = complex.create %[[RESULT_REAL_WITH_SPECIAL_CASES]], %[[RESULT_IMAG_WITH_SPECIAL_CASES]] : complex // CHECK: return %[[RESULT]] : complex + +// ----- + +// CHECK-LABEL: func @complex_tanh_with_fmf +// CHECK-SAME: %[[ARG:.*]]: complex +func.func @complex_tanh_with_fmf(%arg: complex) -> complex { + %tanh = complex.tanh %arg fastmath : complex + return %tanh : complex +} +// CHECK: %[[REAL:.*]] = complex.re %[[ARG]] : complex +// CHECK: %[[IMAG:.*]] = complex.im %[[ARG]] : complex +// CHECK: %[[TANH_A:.*]] = math.tanh %[[REAL]] fastmath : f32 +// CHECK: %[[COS_B:.*]] = math.cos %[[IMAG]] fastmath : f32 +// CHECK: %[[SIN_B:.*]] = math.sin %[[IMAG]] fastmath : f32 +// CHECK: %[[TAN_B:.*]] = arith.divf %[[SIN_B]], %[[COS_B]] fastmath : f32 +// CHECK: %[[NUM:.*]] = complex.create %[[TANH_A]], %[[TAN_B]] : complex +// CHECK: %[[ONE:.*]] = arith.constant 1.000000e+00 : f32 +// CHECK: %[[MUL:.*]] = arith.mulf %[[TANH_A]], %[[TAN_B]] fastmath : f32 +// CHECK: %[[DENOM:.*]] = complex.create %[[ONE]], %[[MUL]] : complex \ No newline at end of file From 6c2cc8240e11721cac466cfce89bc0f87a5019be Mon Sep 17 00:00:00 2001 From: David Green Date: Sun, 14 Apr 2024 12:09:14 +0100 Subject: [PATCH 02/10] [AArch64] Improve cost of non-zero lane splats This adds a cost for non-zero lane splats, which is not included by default in SK_Broadcast but can be handled by aarch64 dup lane instruction. --- llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp | 5 ++++- llvm/test/Analysis/CostModel/AArch64/shuffle-other.ll | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp index bd943de06b4b2a..e80931a03f30b6 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -3939,7 +3939,10 @@ InstructionCost AArch64TTIImpl::getShuffleCost( LT.second.getVectorNumElements() == Mask.size() && (Kind == TTI::SK_PermuteTwoSrc || Kind == TTI::SK_PermuteSingleSrc) && (isZIPMask(Mask, LT.second, Unused) || - isUZPMask(Mask, LT.second, Unused))) + isUZPMask(Mask, LT.second, Unused) || + // Check for non-zero lane splats + all_of(drop_begin(Mask), + [&Mask](int M) { return M < 0 || M == Mask[0]; }))) return 1; if (Kind == TTI::SK_Broadcast || Kind == TTI::SK_Transpose || diff --git a/llvm/test/Analysis/CostModel/AArch64/shuffle-other.ll b/llvm/test/Analysis/CostModel/AArch64/shuffle-other.ll index 6c45ebcb69f400..d67f056366104e 100644 --- a/llvm/test/Analysis/CostModel/AArch64/shuffle-other.ll +++ b/llvm/test/Analysis/CostModel/AArch64/shuffle-other.ll @@ -361,9 +361,9 @@ define void @uzp() { define void @multipart() { ; CHECK-LABEL: 'multipart' ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16a = shufflevector <8 x i16> undef, <8 x i16> undef, <8 x i32> -; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v16b = shufflevector <8 x i16> undef, <8 x i16> undef, <8 x i32> -; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v16c = shufflevector <16 x i16> undef, <16 x i16> undef, <16 x i32> -; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %v16d = shufflevector <16 x i16> undef, <16 x i16> undef, <16 x i32> +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16b = shufflevector <8 x i16> undef, <8 x i16> undef, <8 x i32> +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v16c = shufflevector <16 x i16> undef, <16 x i16> undef, <16 x i32> +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v16d = shufflevector <16 x i16> undef, <16 x i16> undef, <16 x i32> ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v32a = shufflevector <4 x i32> undef, <4 x i32> undef, <4 x i32> ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32a4 = shufflevector <16 x i32> undef, <16 x i32> undef, <16 x i32> ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32idrev = shufflevector <16 x i32> undef, <16 x i32> undef, <16 x i32> From 9b832b726c9c9bb0672c5f0912f6f131e3e27a10 Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Sun, 14 Apr 2024 14:37:51 +0300 Subject: [PATCH 03/10] [libc++] Deprecated `shared_ptr` Atomic Access APIs as per P0718R2 & Implemented P2869R3: Remove Deprecated `shared_ptr` Atomic Access APIs from C++26 (#87111) Implements https://wg21.link/P2869R4 Implements deprecations as per https://wg21.link/P0718R2 --- libcxx/docs/ReleaseNotes/19.rst | 4 +++ libcxx/docs/Status/Cxx20.rst | 2 ++ libcxx/docs/Status/Cxx20Papers.csv | 2 +- libcxx/docs/Status/Cxx2cPapers.csv | 2 +- libcxx/docs/UsingLibcxx.rst | 4 +++ libcxx/include/__memory/shared_ptr.h | 29 ++++++++++------ libcxx/include/memory | 22 ++++++------ libcxx/modules/std/memory.inc | 6 ++++ ..._exchange_strong.depr_in_cxx20..verify.cpp | 32 +++++++++++++++++ ...e_strong_explicit.depr_in_cxx20.verify.cpp | 34 +++++++++++++++++++ ...re_exchange_weak.depr_in_cxx20..verify.cpp | 31 +++++++++++++++++ ...ge_weak_explicit.depr_in_cxx20..verify.cpp | 34 +++++++++++++++++++ .../atomic_exchange.depr_in_cxx20..verify.cpp | 29 ++++++++++++++++ ...xchange_explicit.verify.depr_in_cxx20..cpp | 30 ++++++++++++++++ ...mic_is_lock_free.depr_in_cxx20..verify.cpp | 28 +++++++++++++++ .../atomic_load.depr_in_cxx20..verify.cpp | 28 +++++++++++++++ ...ic_load_explicit.depr_in_cxx20..verify.cpp | 29 ++++++++++++++++ .../atomic_store.depr_in_cxx20..verify.cpp | 28 +++++++++++++++ ...c_store_explicit.depr_in_cxx20..verify.cpp | 29 ++++++++++++++++ .../atomic_compare_exchange_strong.pass.cpp | 6 ++-- ..._compare_exchange_strong_explicit.pass.cpp | 6 ++-- .../atomic_compare_exchange_weak.pass.cpp | 6 ++-- ...ic_compare_exchange_weak_explicit.pass.cpp | 6 ++-- .../atomic_exchange.pass.cpp | 6 ++-- .../atomic_exchange_explicit.pass.cpp | 6 ++-- .../atomic_is_lock_free.pass.cpp | 6 ++-- .../atomic_load.pass.cpp | 6 ++-- .../atomic_load_explicit.pass.cpp | 6 ++-- .../atomic_store.pass.cpp | 6 ++-- .../atomic_store_explicit.pass.cpp | 6 ++-- 30 files changed, 423 insertions(+), 46 deletions(-) create mode 100644 libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_strong.depr_in_cxx20..verify.cpp create mode 100644 libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.depr_in_cxx20.verify.cpp create mode 100644 libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_weak.depr_in_cxx20..verify.cpp create mode 100644 libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.depr_in_cxx20..verify.cpp create mode 100644 libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_exchange.depr_in_cxx20..verify.cpp create mode 100644 libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_exchange_explicit.verify.depr_in_cxx20..cpp create mode 100644 libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_is_lock_free.depr_in_cxx20..verify.cpp create mode 100644 libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_load.depr_in_cxx20..verify.cpp create mode 100644 libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_load_explicit.depr_in_cxx20..verify.cpp create mode 100644 libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_store.depr_in_cxx20..verify.cpp create mode 100644 libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_store_explicit.depr_in_cxx20..verify.cpp diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst index 390de789ddb643..e5db17daa48233 100644 --- a/libcxx/docs/ReleaseNotes/19.rst +++ b/libcxx/docs/ReleaseNotes/19.rst @@ -43,6 +43,7 @@ Implemented Papers - P2819R2 - Add ``tuple`` protocol to ``complex`` - P2495R3 - Interfacing ``stringstream``\s with ``string_view`` - P2867R2 - Remove Deprecated ``strstream``\s From C++26 +- P2869R4 - Remove Deprecated ``shared_ptr`` Atomic Access APIs from C++26 - P2872R3 - Remove ``wstring_convert`` From C++26 - P3142R0 - Printing Blank Lines with ``println`` (as DR against C++23) - P2302R4 - ``std::ranges::contains`` @@ -63,6 +64,9 @@ Improvements and New Features - The ``_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM`` macro has been added to make the declarations in ```` available. +- The ``_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS`` macro has been added to make the declarations in ```` + available. + - The ``_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT`` macro has been added to make the declarations in ```` available. diff --git a/libcxx/docs/Status/Cxx20.rst b/libcxx/docs/Status/Cxx20.rst index 2deb82547d6310..23289dc6e5961b 100644 --- a/libcxx/docs/Status/Cxx20.rst +++ b/libcxx/docs/Status/Cxx20.rst @@ -59,6 +59,8 @@ Paper Status * ``GPS clock`` not done * ``UTC clock`` not done + .. [#note-P0718] P0718: Implemented deprecation of ``shared_ptr`` atomic access APIs only. + .. _issues-status-cxx20: Library Working Group Issues Status diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv index 6e4678da288875..d31720b7576d72 100644 --- a/libcxx/docs/Status/Cxx20Papers.csv +++ b/libcxx/docs/Status/Cxx20Papers.csv @@ -12,7 +12,7 @@ "`P0600R1 `__","LWG","nodiscard in the Library","Albuquerque","|Complete|","16.0" "`P0616R0 `__","LWG","de-pessimize legacy algorithms with std::move","Albuquerque","|Complete|","12.0" "`P0653R2 `__","LWG","Utility to convert a pointer to a raw pointer","Albuquerque","|Complete|","6.0" -"`P0718R2 `__","LWG","Atomic shared_ptr","Albuquerque","","" +"`P0718R2 `__","LWG","Atomic shared_ptr","Albuquerque","|Partial| [#note-P0718]_","" "`P0767R1 `__","CWG","Deprecate POD","Albuquerque","|Complete|","7.0" "`P0768R1 `__","CWG","Library Support for the Spaceship (Comparison) Operator","Albuquerque","|Complete|","" "`P0777R1 `__","LWG","Treating Unnecessary ``decay``\ ","Albuquerque","|Complete|","7.0" diff --git a/libcxx/docs/Status/Cxx2cPapers.csv b/libcxx/docs/Status/Cxx2cPapers.csv index 8516070c72b8fb..1b00a05ad3d6fd 100644 --- a/libcxx/docs/Status/Cxx2cPapers.csv +++ b/libcxx/docs/Status/Cxx2cPapers.csv @@ -48,7 +48,7 @@ "","","","","","","" "`P2875R4 `__","LWG","Undeprecate ``polymorphic_allocator::destroy`` for C++26","Tokyo March 2024","|Complete|","15.0","" "`P2867R2 `__","LWG","Remove Deprecated ``strstreams`` From C++26","Tokyo March 2024","|Complete|","19.0","" -"`P2869R4 `__","LWG","Remove Deprecated ``shared_ptr`` Atomic Access APIs from C++26","Tokyo March 2024","","","" +"`P2869R4 `__","LWG","Remove Deprecated ``shared_ptr`` Atomic Access APIs from C++26","Tokyo March 2024","|Complete|","19.0","" "`P2872R3 `__","LWG","Remove ``wstring_convert`` From C++26","Tokyo March 2024","|Complete|","19.0","" "`P3107R5 `__","LWG","Permit an efficient implementation of ``std::print``","Tokyo March 2024","","","|format| |DR|" "`P3142R0 `__","LWG","Printing Blank Lines with ``println``","Tokyo March 2024","|Complete|","19.0","|format|" diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst index bc7817d14d04d0..c0e85ad4d5e247 100644 --- a/libcxx/docs/UsingLibcxx.rst +++ b/libcxx/docs/UsingLibcxx.rst @@ -277,10 +277,14 @@ C++26 Specific Configuration Macros **_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM**: This macro is used to re-enable all named declarations in ````. +**_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS**: + This macro is used to re-enable all ``shared_ptr`` atomic access APIs in ````. + **_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT**: This macro is used to re-enable the ``wstring_convert`` and ``wbuffer_convert`` in ````. + Libc++ Extensions ================= diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h index a8ff189df2aa52..992b1ba43f100d 100644 --- a/libcxx/include/__memory/shared_ptr.h +++ b/libcxx/include/__memory/shared_ptr.h @@ -1580,13 +1580,15 @@ class _LIBCPP_EXPORTED_FROM_ABI __sp_mut { _LIBCPP_EXPORTED_FROM_ABI __sp_mut& __get_sp_mut(const void*); +# if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS) + template -inline _LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const shared_ptr<_Tp>*) { +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const shared_ptr<_Tp>*) { return false; } template -_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_load(const shared_ptr<_Tp>* __p) { +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_load(const shared_ptr<_Tp>* __p) { __sp_mut& __m = std::__get_sp_mut(__p); __m.lock(); shared_ptr<_Tp> __q = *__p; @@ -1595,12 +1597,13 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_load(const shared_ptr<_Tp>* __p) { } template -inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) { +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> +atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) { return std::atomic_load(__p); } template -_LIBCPP_HIDE_FROM_ABI void atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { __sp_mut& __m = std::__get_sp_mut(__p); __m.lock(); __p->swap(__r); @@ -1608,12 +1611,14 @@ _LIBCPP_HIDE_FROM_ABI void atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __ } template -inline _LIBCPP_HIDE_FROM_ABI void atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) { +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void +atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) { std::atomic_store(__p, __r); } template -_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> +atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { __sp_mut& __m = std::__get_sp_mut(__p); __m.lock(); __p->swap(__r); @@ -1622,13 +1627,13 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_exchange(shared_ptr<_Tp>* __p, shar } template -inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) { return std::atomic_exchange(__p, __r); } template -_LIBCPP_HIDE_FROM_ABI bool +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) { shared_ptr<_Tp> __temp; __sp_mut& __m = std::__get_sp_mut(__p); @@ -1646,23 +1651,25 @@ atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, share } template -inline _LIBCPP_HIDE_FROM_ABI bool +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) { return std::atomic_compare_exchange_strong(__p, __v, __w); } template -inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit( +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit( shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) { return std::atomic_compare_exchange_strong(__p, __v, __w); } template -inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit( +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit( shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) { return std::atomic_compare_exchange_weak(__p, __v, __w); } +# endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS) + #endif // !defined(_LIBCPP_HAS_NO_THREADS) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/memory b/libcxx/include/memory index a8c0264eb9eb78..30fadce760d752 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -830,34 +830,34 @@ public: }; template - bool atomic_is_lock_free(const shared_ptr* p); + bool atomic_is_lock_free(const shared_ptr* p); // Deprecated in C++20, removed in C++26 template - shared_ptr atomic_load(const shared_ptr* p); + shared_ptr atomic_load(const shared_ptr* p); // Deprecated in C++20, removed in C++26 template - shared_ptr atomic_load_explicit(const shared_ptr* p, memory_order mo); + shared_ptr atomic_load_explicit(const shared_ptr* p, memory_order mo); // Deprecated in C++20, removed in C++26 template - void atomic_store(shared_ptr* p, shared_ptr r); + void atomic_store(shared_ptr* p, shared_ptr r); // Deprecated in C++20, removed in C++26 template - void atomic_store_explicit(shared_ptr* p, shared_ptr r, memory_order mo); + void atomic_store_explicit(shared_ptr* p, shared_ptr r, memory_order mo); // Deprecated in C++20, removed in C++26 template - shared_ptr atomic_exchange(shared_ptr* p, shared_ptr r); + shared_ptr atomic_exchange(shared_ptr* p, shared_ptr r); // Deprecated in C++20, removed in C++26 template shared_ptr - atomic_exchange_explicit(shared_ptr* p, shared_ptr r, memory_order mo); + atomic_exchange_explicit(shared_ptr* p, shared_ptr r, memory_order mo); // Deprecated in C++20, removed in C++26 template bool - atomic_compare_exchange_weak(shared_ptr* p, shared_ptr* v, shared_ptr w); + atomic_compare_exchange_weak(shared_ptr* p, shared_ptr* v, shared_ptr w); // Deprecated in C++20, removed in C++26 template bool - atomic_compare_exchange_strong( shared_ptr* p, shared_ptr* v, shared_ptr w); + atomic_compare_exchange_strong( shared_ptr* p, shared_ptr* v, shared_ptr w); // Deprecated in C++20, removed in C++26 template bool - atomic_compare_exchange_weak_explicit(shared_ptr* p, shared_ptr* v, + atomic_compare_exchange_weak_explicit(shared_ptr* p, shared_ptr* v, // Deprecated in C++20, removed in C++26 shared_ptr w, memory_order success, memory_order failure); template bool - atomic_compare_exchange_strong_explicit(shared_ptr* p, shared_ptr* v, + atomic_compare_exchange_strong_explicit(shared_ptr* p, shared_ptr* v, // Deprecated in C++20, removed in C++26 shared_ptr w, memory_order success, memory_order failure); // Hash support diff --git a/libcxx/modules/std/memory.inc b/libcxx/modules/std/memory.inc index 56c621c0cf17fb..b23c27707afd63 100644 --- a/libcxx/modules/std/memory.inc +++ b/libcxx/modules/std/memory.inc @@ -190,6 +190,9 @@ export namespace std { // using std::inout_ptr; #ifndef _LIBCPP_HAS_NO_THREADS + +# if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS) + // [depr.util.smartptr.shared.atomic] using std::atomic_is_lock_free; @@ -206,5 +209,8 @@ export namespace std { using std::atomic_compare_exchange_strong_explicit; using std::atomic_compare_exchange_weak; using std::atomic_compare_exchange_weak_explicit; + +# endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS) + #endif // _LIBCPP_HAS_NO_THREADS } // namespace std diff --git a/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_strong.depr_in_cxx20..verify.cpp b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_strong.depr_in_cxx20..verify.cpp new file mode 100644 index 00000000000000..3ca01cad451a21 --- /dev/null +++ b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_strong.depr_in_cxx20..verify.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// UNSUPPORTED: no-threads +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// shared_ptr + +// template +// bool +// atomic_compare_exchange_strong(shared_ptr* p, shared_ptr* v, +// shared_ptr w); // Deprecated in C++20, removed in C++26 + +#include +#include +#include + +void test() { + std::shared_ptr p(new int(4)); + std::shared_ptr v(new int(3)); + std::shared_ptr w(new int(2)); + // expected-warning@+1 {{'atomic_compare_exchange_strong' is deprecated}} + std::ignore = std::atomic_compare_exchange_strong(&p, &v, w); +} diff --git a/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.depr_in_cxx20.verify.cpp b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.depr_in_cxx20.verify.cpp new file mode 100644 index 00000000000000..93384772c8afc7 --- /dev/null +++ b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.depr_in_cxx20.verify.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// UNSUPPORTED: no-threads +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// shared_ptr + +// template +// bool +// atomic_compare_exchange_strong_explicit(shared_ptr* p, shared_ptr* v, +// shared_ptr w, memory_order success, +// memory_order failure); // Deprecated in C++20, removed in C++26 + +#include +#include +#include + +void test() { + std::shared_ptr p(new int(4)); + std::shared_ptr v(new int(3)); + std::shared_ptr w(new int(2)); + // expected-warning@+2 {{'atomic_compare_exchange_strong_explicit' is deprecated}} + std::ignore = + std::atomic_compare_exchange_strong_explicit(&p, &v, w, std::memory_order_seq_cst, std::memory_order_seq_cst); +} diff --git a/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_weak.depr_in_cxx20..verify.cpp b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_weak.depr_in_cxx20..verify.cpp new file mode 100644 index 00000000000000..30ca70523fb647 --- /dev/null +++ b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_weak.depr_in_cxx20..verify.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// UNSUPPORTED: no-threads +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// shared_ptr + +// template +// bool +// atomic_compare_exchange_weak(shared_ptr* p, shared_ptr* v, +// shared_ptr w); // Deprecated in C++20, removed in C++26 + +#include +#include + +int main(int, char**) { + std::shared_ptr p(new int(4)); + std::shared_ptr v(new int(3)); + std::shared_ptr w(new int(2)); + // expected-warning@+1 {{'atomic_compare_exchange_weak' is deprecated}} + std::ignore = std::atomic_compare_exchange_weak(&p, &v, w); +} diff --git a/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.depr_in_cxx20..verify.cpp b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.depr_in_cxx20..verify.cpp new file mode 100644 index 00000000000000..ae6e98d0692d24 --- /dev/null +++ b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.depr_in_cxx20..verify.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// UNSUPPORTED: no-threads +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// shared_ptr + +// template +// bool +// atomic_compare_exchange_weak_explicit(shared_ptr* p, shared_ptr* v, +// shared_ptr w, memory_order success, +// memory_order failure); // Deprecated in C++20, removed in C++26 + +#include +#include +#include + +void test() { + std::shared_ptr p(new int(4)); + std::shared_ptr v(new int(3)); + std::shared_ptr w(new int(2)); + // expected-warning@+2 {{'atomic_compare_exchange_weak_explicit' is deprecated}} + std::ignore = + std::atomic_compare_exchange_weak_explicit(&p, &v, w, std::memory_order_seq_cst, std::memory_order_seq_cst); +} diff --git a/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_exchange.depr_in_cxx20..verify.cpp b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_exchange.depr_in_cxx20..verify.cpp new file mode 100644 index 00000000000000..0e4bc1bc50b18b --- /dev/null +++ b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_exchange.depr_in_cxx20..verify.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// UNSUPPORTED: no-threads +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// shared_ptr + +// template +// shared_ptr +// atomic_exchange(shared_ptr* p, shared_ptr r) // Deprecated in C++20, removed in C++26 + +#include +#include + +void test() { + std::shared_ptr p(new int(4)); + std::shared_ptr r(new int(3)); + // expected-warning@+1 {{'atomic_exchange' is deprecated}} + std::ignore = std::atomic_exchange(&p, r); +} diff --git a/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_exchange_explicit.verify.depr_in_cxx20..cpp b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_exchange_explicit.verify.depr_in_cxx20..cpp new file mode 100644 index 00000000000000..5a6a2bfe4c1e29 --- /dev/null +++ b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_exchange_explicit.verify.depr_in_cxx20..cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// UNSUPPORTED: no-threads +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// shared_ptr + +// template +// shared_ptr +// atomic_exchange_explicit(shared_ptr* p, shared_ptr r) // Deprecated in C++20, removed in C++26 + +#include +#include +#include + +void test() { + std::shared_ptr p(new int(4)); + std::shared_ptr r(new int(3)); + // expected-warning@+1 {{'atomic_exchange_explicit' is deprecated}} + std::ignore = std::atomic_exchange_explicit(&p, r, std::memory_order_seq_cst); +} diff --git a/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_is_lock_free.depr_in_cxx20..verify.cpp b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_is_lock_free.depr_in_cxx20..verify.cpp new file mode 100644 index 00000000000000..6799d31ce1fa95 --- /dev/null +++ b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_is_lock_free.depr_in_cxx20..verify.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// UNSUPPORTED: no-threads +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// shared_ptr + +// template +// bool +// atomic_is_lock_free(const shared_ptr* p); // Deprecated in C++20, removed in C++26 + +#include +#include + +void test() { + const std::shared_ptr p(new int(3)); + // expected-warning@+1 {{'atomic_is_lock_free' is deprecated}} + std::ignore = std::atomic_is_lock_free(&p); +} diff --git a/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_load.depr_in_cxx20..verify.cpp b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_load.depr_in_cxx20..verify.cpp new file mode 100644 index 00000000000000..768ad0ded983e7 --- /dev/null +++ b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_load.depr_in_cxx20..verify.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// UNSUPPORTED: no-threads +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// shared_ptr + +// template +// shared_ptr +// atomic_load(const shared_ptr* p) // Deprecated in C++20, removed in C++26 + +#include +#include + +void test() { + std::shared_ptr p(new int(3)); + // expected-warning@+1 {{'atomic_load' is deprecated}} + std::ignore = std::atomic_load(&p); +} diff --git a/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_load_explicit.depr_in_cxx20..verify.cpp b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_load_explicit.depr_in_cxx20..verify.cpp new file mode 100644 index 00000000000000..dc56193324f04f --- /dev/null +++ b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_load_explicit.depr_in_cxx20..verify.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// UNSUPPORTED: no-threads +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// shared_ptr + +// template +// shared_ptr +// atomic_load_explicit(const shared_ptr* p, memory_order mo) // Deprecated in C++20, removed in C++26 + +#include +#include +#include + +void test() { + const std::shared_ptr p(new int(3)); + // expected-warning@+1 {{'atomic_load_explicit' is deprecated}} + std::ignore = std::atomic_load_explicit(&p, std::memory_order_relaxed); +} diff --git a/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_store.depr_in_cxx20..verify.cpp b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_store.depr_in_cxx20..verify.cpp new file mode 100644 index 00000000000000..38b8df6f24393c --- /dev/null +++ b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_store.depr_in_cxx20..verify.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// UNSUPPORTED: no-threads +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// shared_ptr + +// template +// void +// atomic_store(shared_ptr* p, shared_ptr r) // Deprecated in C++20, removed in C++26 + +#include + +void test() { + std::shared_ptr p; + std::shared_ptr r(new int(3)); + // expected-warning@+1 {{'atomic_store' is deprecated}} + std::atomic_store(&p, r); +} diff --git a/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_store_explicit.depr_in_cxx20..verify.cpp b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_store_explicit.depr_in_cxx20..verify.cpp new file mode 100644 index 00000000000000..18f59c46186996 --- /dev/null +++ b/libcxx/test/libcxx/depr/depr.util.smartptr.shared.atomic/atomic_store_explicit.depr_in_cxx20..verify.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// UNSUPPORTED: no-threads +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// shared_ptr + +// template +// void +// atomic_store_explicit(shared_ptr* p, shared_ptr r, memory_order mo) // Deprecated in C++20, removed in C++26 + +#include +#include + +void test() { + std::shared_ptr p; + std::shared_ptr r(new int(3)); + // expected-warning@+1 {{'atomic_store_explicit' is deprecated}} + std::atomic_store_explicit(&p, r, std::memory_order_seq_cst); +} diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp index 37be6ceea3e094..ad9d2a9d9ccc00 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp @@ -5,7 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // UNSUPPORTED: no-threads // @@ -15,7 +17,7 @@ // template // bool // atomic_compare_exchange_strong(shared_ptr* p, shared_ptr* v, -// shared_ptr w); +// shared_ptr w); // Deprecated in C++20, removed in C++26 // UNSUPPORTED: c++03 diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp index 3965863b86ccf5..26496df96d472d 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp @@ -5,7 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // UNSUPPORTED: no-threads // @@ -16,7 +18,7 @@ // bool // atomic_compare_exchange_strong_explicit(shared_ptr* p, shared_ptr* v, // shared_ptr w, memory_order success, -// memory_order failure); +// memory_order failure); // Deprecated in C++20, removed in C++26 // UNSUPPORTED: c++03 diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp index 6dd04f924a105e..5cdc0ea3312ff5 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp @@ -5,7 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // UNSUPPORTED: no-threads // @@ -15,7 +17,7 @@ // template // bool // atomic_compare_exchange_weak(shared_ptr* p, shared_ptr* v, -// shared_ptr w); +// shared_ptr w); // Deprecated in C++20, removed in C++26 // UNSUPPORTED: c++03 diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp index 4837fa9793a5e8..e4cc4cf77a64e2 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp @@ -5,7 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // UNSUPPORTED: no-threads // @@ -16,7 +18,7 @@ // bool // atomic_compare_exchange_weak_explicit(shared_ptr* p, shared_ptr* v, // shared_ptr w, memory_order success, -// memory_order failure); +// memory_order failure); // Deprecated in C++20, removed in C++26 // UNSUPPORTED: c++03 diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp index f488e0ed1d14e1..db02c9d9f75b42 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp @@ -5,7 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // UNSUPPORTED: no-threads // @@ -14,7 +16,7 @@ // template // shared_ptr -// atomic_exchange(shared_ptr* p, shared_ptr r) +// atomic_exchange(shared_ptr* p, shared_ptr r) // Deprecated in C++20, removed in C++26 // UNSUPPORTED: c++03 diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp index 1945f7bba6dc06..704232e71fa4ae 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp @@ -5,7 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // UNSUPPORTED: no-threads // @@ -14,7 +16,7 @@ // template // shared_ptr -// atomic_exchange_explicit(shared_ptr* p, shared_ptr r) +// atomic_exchange_explicit(shared_ptr* p, shared_ptr r) // Deprecated in C++20, removed in C++26 // UNSUPPORTED: c++03 diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp index 37f7d12eda2c62..8f3b5bbb51558b 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp @@ -5,7 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // UNSUPPORTED: no-threads // @@ -14,7 +16,7 @@ // template // bool -// atomic_is_lock_free(const shared_ptr* p); +// atomic_is_lock_free(const shared_ptr* p); // Deprecated in C++20, removed in C++26 // UNSUPPORTED: c++03 diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp index 1b9a15ac92ac1f..9d81e81b4392b8 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp @@ -5,7 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // UNSUPPORTED: no-threads // @@ -14,7 +16,7 @@ // template // shared_ptr -// atomic_load(const shared_ptr* p) +// atomic_load(const shared_ptr* p) // Deprecated in C++20, removed in C++26 // UNSUPPORTED: c++03 diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp index 5c2970133328f3..f4875dce38a810 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp @@ -5,7 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // UNSUPPORTED: no-threads // @@ -14,7 +16,7 @@ // template // shared_ptr -// atomic_load_explicit(const shared_ptr* p, memory_order mo) +// atomic_load_explicit(const shared_ptr* p, memory_order mo) // Deprecated in C++20, removed in C++26 // UNSUPPORTED: c++03 diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp index 5b7bd5fad69c47..836dcb16ff32e3 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp @@ -5,7 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // UNSUPPORTED: no-threads // @@ -14,7 +16,7 @@ // template // void -// atomic_store(shared_ptr* p, shared_ptr r) +// atomic_store(shared_ptr* p, shared_ptr r) // Deprecated in C++20, removed in C++26 // UNSUPPORTED: c++03 diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp index 5712190421308d..85b31c017d7362 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp @@ -5,7 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // UNSUPPORTED: no-threads // @@ -14,7 +16,7 @@ // template // void -// atomic_store_explicit(shared_ptr* p, shared_ptr r, memory_order mo) +// atomic_store_explicit(shared_ptr* p, shared_ptr r, memory_order mo) // Deprecated in C++20, removed in C++26 // UNSUPPORTED: c++03 From 6e934b7cfba8e0c167d2b287a30dfc1b720397c1 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Sun, 14 Apr 2024 20:34:26 +0800 Subject: [PATCH 04/10] [clang] Fix -Wunused-variable in SemaCast.cpp (NFC) llvm-project/clang/lib/Sema/SemaCast.cpp:503:23: error: unused variable 'Res' [-Werror,-Wunused-variable] OverloadingResult Res = ^ 1 error generated. --- clang/lib/Sema/SemaCast.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp index aac43e2cad603f..b0c28531fe8738 100644 --- a/clang/lib/Sema/SemaCast.cpp +++ b/clang/lib/Sema/SemaCast.cpp @@ -500,7 +500,7 @@ static bool tryDiagnoseOverloadedCast(Sema &S, CastType CT, case OR_Deleted: { OverloadCandidateSet::iterator Best; - OverloadingResult Res = + [[maybe_unused]] OverloadingResult Res = candidates.BestViableFunction(S, range.getBegin(), Best); assert(Res == OR_Deleted && "Inconsistent overload resolution"); From 3c4d9559495e60dcbb431ab80d806096559a7486 Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Sun, 14 Apr 2024 06:36:40 -0700 Subject: [PATCH 05/10] [mlir] Add lib to tests for shared build (#88574) These resulted in link failures: ``` /usr/bin/ld: tools/mlir/test/CAPI/CMakeFiles/mlir-capi-translation-test.dir/translation.c.o: in function `main': translation.c:(.text.main+0x58): undefined reference to `LLVMContextCreate' /usr/bin/ld: translation.c:(.text.main+0x9b): undefined reference to `LLVMDumpModule' /usr/bin/ld: translation.c:(.text.main+0xa3): undefined reference to `LLVMDisposeModule' /usr/bin/ld: translation.c:(.text.main+0xb3): undefined reference to `LLVMContextDispose' ``` Found in mlir-hs. Not sure why this hasn't been flagged elsewhere. --- mlir/test/CAPI/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/mlir/test/CAPI/CMakeLists.txt b/mlir/test/CAPI/CMakeLists.txt index 79b61fdef38b49..b9cd63ef7c673d 100644 --- a/mlir/test/CAPI/CMakeLists.txt +++ b/mlir/test/CAPI/CMakeLists.txt @@ -12,6 +12,7 @@ function(_add_capi_test_executable name) llvm_update_compile_flags(${name}) if(MLIR_BUILD_MLIR_C_DYLIB) target_link_libraries(${name} PRIVATE + LLVMCore MLIR-C) else() target_link_libraries(${name} PRIVATE From 7cfe73624780010ec81ca11c41ebbf214400abdd Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 14 Apr 2024 17:51:15 +0400 Subject: [PATCH 06/10] [clang] Fix name conflict with `sys/mac.h` on AIX (#88644) Fixes clang-ppc64-aix bot failure after #88559 (0a6f6df5b0c3d0f2a42f013bf5cafb9b5020dcac) https://lab.llvm.org/buildbot/#/builders/214/builds/11887 --------- Co-authored-by: Joseph Huber --- clang/include/clang/Basic/Cuda.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/include/clang/Basic/Cuda.h b/clang/include/clang/Basic/Cuda.h index acc6bb6581d857..38f30543a0f662 100644 --- a/clang/include/clang/Basic/Cuda.h +++ b/clang/include/clang/Basic/Cuda.h @@ -50,6 +50,10 @@ const char *CudaVersionToString(CudaVersion V); // Input is "Major.Minor" CudaVersion CudaStringToVersion(const llvm::Twine &S); +// We have a name conflict with sys/mac.h on AIX +#ifdef SM_32 +#undef SM_32 +#endif enum class CudaArch { UNUSED, UNKNOWN, From d5c654b5b7c8bb81affdc69976ef9bc5ad5b4302 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Sun, 14 Apr 2024 15:52:56 +0200 Subject: [PATCH 07/10] [libc++][RFC] Only include what is required by-version in the umbrella headers (#83740) This is a relatively low cost way of reducing the include sizes in older language modes compared to the effect. For example, in C++14 mode the include time of `` is reduced from 198ms to 127ms. --- libcxx/include/algorithm | 259 +++++++++--------- libcxx/include/bit | 36 ++- libcxx/include/charconv | 32 ++- libcxx/include/chrono | 75 ++--- libcxx/include/compare | 36 ++- libcxx/include/concepts | 52 ++-- libcxx/include/coroutine | 4 + libcxx/include/module.modulemap | 5 +- libcxx/include/streambuf | 1 + .../libcxx/algorithms/half_positive.pass.cpp | 4 +- libcxx/test/libcxx/numerics/bit.ops.pass.cpp | 4 +- .../test/libcxx/time/convert_to_tm.pass.cpp | 1 + .../test/libcxx/transitive_includes/cxx03.csv | 12 +- .../test/libcxx/transitive_includes/cxx11.csv | 13 +- .../test/libcxx/transitive_includes/cxx14.csv | 12 + .../test/libcxx/transitive_includes/cxx17.csv | 12 + .../test/libcxx/transitive_includes/cxx20.csv | 12 + .../test/libcxx/transitive_includes/cxx23.csv | 13 + .../test/libcxx/transitive_includes/cxx26.csv | 13 + 19 files changed, 374 insertions(+), 222 deletions(-) diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm index 0f62de7fa83f98..869fc19737b572 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -1794,15 +1794,11 @@ template */ #include <__config> -#include #include <__algorithm/adjacent_find.h> #include <__algorithm/all_of.h> #include <__algorithm/any_of.h> #include <__algorithm/binary_search.h> -#include <__algorithm/clamp.h> -#include <__algorithm/comp.h> -#include <__algorithm/comp_ref_type.h> #include <__algorithm/copy.h> #include <__algorithm/copy_backward.h> #include <__algorithm/copy_if.h> @@ -1818,18 +1814,9 @@ template #include <__algorithm/find_first_of.h> #include <__algorithm/find_if.h> #include <__algorithm/find_if_not.h> -#include <__algorithm/fold.h> #include <__algorithm/for_each.h> -#include <__algorithm/for_each_n.h> #include <__algorithm/generate.h> #include <__algorithm/generate_n.h> -#include <__algorithm/half_positive.h> -#include <__algorithm/in_found_result.h> -#include <__algorithm/in_fun_result.h> -#include <__algorithm/in_in_out_result.h> -#include <__algorithm/in_in_result.h> -#include <__algorithm/in_out_out_result.h> -#include <__algorithm/in_out_result.h> #include <__algorithm/includes.h> #include <__algorithm/inplace_merge.h> #include <__algorithm/is_heap.h> @@ -1840,7 +1827,6 @@ template #include <__algorithm/is_sorted_until.h> #include <__algorithm/iter_swap.h> #include <__algorithm/lexicographical_compare.h> -#include <__algorithm/lexicographical_compare_three_way.h> #include <__algorithm/lower_bound.h> #include <__algorithm/make_heap.h> #include <__algorithm/max.h> @@ -1848,7 +1834,6 @@ template #include <__algorithm/merge.h> #include <__algorithm/min.h> #include <__algorithm/min_element.h> -#include <__algorithm/min_max_result.h> #include <__algorithm/minmax.h> #include <__algorithm/minmax_element.h> #include <__algorithm/mismatch.h> @@ -1864,112 +1849,7 @@ template #include <__algorithm/partition_point.h> #include <__algorithm/pop_heap.h> #include <__algorithm/prev_permutation.h> -#include <__algorithm/pstl_any_all_none_of.h> -#include <__algorithm/pstl_copy.h> -#include <__algorithm/pstl_count.h> -#include <__algorithm/pstl_equal.h> -#include <__algorithm/pstl_fill.h> -#include <__algorithm/pstl_find.h> -#include <__algorithm/pstl_for_each.h> -#include <__algorithm/pstl_generate.h> -#include <__algorithm/pstl_is_partitioned.h> -#include <__algorithm/pstl_merge.h> -#include <__algorithm/pstl_move.h> -#include <__algorithm/pstl_replace.h> -#include <__algorithm/pstl_rotate_copy.h> -#include <__algorithm/pstl_sort.h> -#include <__algorithm/pstl_stable_sort.h> -#include <__algorithm/pstl_transform.h> #include <__algorithm/push_heap.h> -#include <__algorithm/ranges_adjacent_find.h> -#include <__algorithm/ranges_all_of.h> -#include <__algorithm/ranges_any_of.h> -#include <__algorithm/ranges_binary_search.h> -#include <__algorithm/ranges_clamp.h> -#include <__algorithm/ranges_contains.h> -#include <__algorithm/ranges_contains_subrange.h> -#include <__algorithm/ranges_copy.h> -#include <__algorithm/ranges_copy_backward.h> -#include <__algorithm/ranges_copy_if.h> -#include <__algorithm/ranges_copy_n.h> -#include <__algorithm/ranges_count.h> -#include <__algorithm/ranges_count_if.h> -#include <__algorithm/ranges_ends_with.h> -#include <__algorithm/ranges_equal.h> -#include <__algorithm/ranges_equal_range.h> -#include <__algorithm/ranges_fill.h> -#include <__algorithm/ranges_fill_n.h> -#include <__algorithm/ranges_find.h> -#include <__algorithm/ranges_find_end.h> -#include <__algorithm/ranges_find_first_of.h> -#include <__algorithm/ranges_find_if.h> -#include <__algorithm/ranges_find_if_not.h> -#include <__algorithm/ranges_for_each.h> -#include <__algorithm/ranges_for_each_n.h> -#include <__algorithm/ranges_generate.h> -#include <__algorithm/ranges_generate_n.h> -#include <__algorithm/ranges_includes.h> -#include <__algorithm/ranges_inplace_merge.h> -#include <__algorithm/ranges_is_heap.h> -#include <__algorithm/ranges_is_heap_until.h> -#include <__algorithm/ranges_is_partitioned.h> -#include <__algorithm/ranges_is_permutation.h> -#include <__algorithm/ranges_is_sorted.h> -#include <__algorithm/ranges_is_sorted_until.h> -#include <__algorithm/ranges_lexicographical_compare.h> -#include <__algorithm/ranges_lower_bound.h> -#include <__algorithm/ranges_make_heap.h> -#include <__algorithm/ranges_max.h> -#include <__algorithm/ranges_max_element.h> -#include <__algorithm/ranges_merge.h> -#include <__algorithm/ranges_min.h> -#include <__algorithm/ranges_min_element.h> -#include <__algorithm/ranges_minmax.h> -#include <__algorithm/ranges_minmax_element.h> -#include <__algorithm/ranges_mismatch.h> -#include <__algorithm/ranges_move.h> -#include <__algorithm/ranges_move_backward.h> -#include <__algorithm/ranges_next_permutation.h> -#include <__algorithm/ranges_none_of.h> -#include <__algorithm/ranges_nth_element.h> -#include <__algorithm/ranges_partial_sort.h> -#include <__algorithm/ranges_partial_sort_copy.h> -#include <__algorithm/ranges_partition.h> -#include <__algorithm/ranges_partition_copy.h> -#include <__algorithm/ranges_partition_point.h> -#include <__algorithm/ranges_pop_heap.h> -#include <__algorithm/ranges_prev_permutation.h> -#include <__algorithm/ranges_push_heap.h> -#include <__algorithm/ranges_remove.h> -#include <__algorithm/ranges_remove_copy.h> -#include <__algorithm/ranges_remove_copy_if.h> -#include <__algorithm/ranges_remove_if.h> -#include <__algorithm/ranges_replace.h> -#include <__algorithm/ranges_replace_copy.h> -#include <__algorithm/ranges_replace_copy_if.h> -#include <__algorithm/ranges_replace_if.h> -#include <__algorithm/ranges_reverse.h> -#include <__algorithm/ranges_reverse_copy.h> -#include <__algorithm/ranges_rotate.h> -#include <__algorithm/ranges_rotate_copy.h> -#include <__algorithm/ranges_sample.h> -#include <__algorithm/ranges_search.h> -#include <__algorithm/ranges_search_n.h> -#include <__algorithm/ranges_set_difference.h> -#include <__algorithm/ranges_set_intersection.h> -#include <__algorithm/ranges_set_symmetric_difference.h> -#include <__algorithm/ranges_set_union.h> -#include <__algorithm/ranges_shuffle.h> -#include <__algorithm/ranges_sort.h> -#include <__algorithm/ranges_sort_heap.h> -#include <__algorithm/ranges_stable_partition.h> -#include <__algorithm/ranges_stable_sort.h> -#include <__algorithm/ranges_starts_with.h> -#include <__algorithm/ranges_swap_ranges.h> -#include <__algorithm/ranges_transform.h> -#include <__algorithm/ranges_unique.h> -#include <__algorithm/ranges_unique_copy.h> -#include <__algorithm/ranges_upper_bound.h> #include <__algorithm/remove.h> #include <__algorithm/remove_copy.h> #include <__algorithm/remove_copy_if.h> @@ -1982,17 +1862,13 @@ template #include <__algorithm/reverse_copy.h> #include <__algorithm/rotate.h> #include <__algorithm/rotate_copy.h> -#include <__algorithm/sample.h> #include <__algorithm/search.h> #include <__algorithm/search_n.h> #include <__algorithm/set_difference.h> #include <__algorithm/set_intersection.h> #include <__algorithm/set_symmetric_difference.h> #include <__algorithm/set_union.h> -#include <__algorithm/shift_left.h> -#include <__algorithm/shift_right.h> #include <__algorithm/shuffle.h> -#include <__algorithm/sift_down.h> #include <__algorithm/sort.h> #include <__algorithm/sort_heap.h> #include <__algorithm/stable_partition.h> @@ -2001,9 +1877,138 @@ template #include <__algorithm/transform.h> #include <__algorithm/unique.h> #include <__algorithm/unique_copy.h> -#include <__algorithm/unwrap_iter.h> #include <__algorithm/upper_bound.h> +#if _LIBCPP_STD_VER >= 17 +# include <__algorithm/clamp.h> +# include <__algorithm/for_each_n.h> +# include <__algorithm/pstl_any_all_none_of.h> +# include <__algorithm/pstl_copy.h> +# include <__algorithm/pstl_count.h> +# include <__algorithm/pstl_equal.h> +# include <__algorithm/pstl_fill.h> +# include <__algorithm/pstl_find.h> +# include <__algorithm/pstl_for_each.h> +# include <__algorithm/pstl_generate.h> +# include <__algorithm/pstl_is_partitioned.h> +# include <__algorithm/pstl_merge.h> +# include <__algorithm/pstl_move.h> +# include <__algorithm/pstl_replace.h> +# include <__algorithm/pstl_rotate_copy.h> +# include <__algorithm/pstl_sort.h> +# include <__algorithm/pstl_stable_sort.h> +# include <__algorithm/pstl_transform.h> +# include <__algorithm/sample.h> +#endif // _LIBCPP_STD_VER >= 17 + +#if _LIBCPP_STD_VER >= 20 +# include <__algorithm/in_found_result.h> +# include <__algorithm/in_fun_result.h> +# include <__algorithm/in_in_out_result.h> +# include <__algorithm/in_in_result.h> +# include <__algorithm/in_out_out_result.h> +# include <__algorithm/in_out_result.h> +# include <__algorithm/lexicographical_compare_three_way.h> +# include <__algorithm/min_max_result.h> +# include <__algorithm/ranges_adjacent_find.h> +# include <__algorithm/ranges_all_of.h> +# include <__algorithm/ranges_any_of.h> +# include <__algorithm/ranges_binary_search.h> +# include <__algorithm/ranges_clamp.h> +# include <__algorithm/ranges_contains.h> +# include <__algorithm/ranges_copy.h> +# include <__algorithm/ranges_copy_backward.h> +# include <__algorithm/ranges_copy_if.h> +# include <__algorithm/ranges_copy_n.h> +# include <__algorithm/ranges_count.h> +# include <__algorithm/ranges_count_if.h> +# include <__algorithm/ranges_equal.h> +# include <__algorithm/ranges_equal_range.h> +# include <__algorithm/ranges_fill.h> +# include <__algorithm/ranges_fill_n.h> +# include <__algorithm/ranges_find.h> +# include <__algorithm/ranges_find_end.h> +# include <__algorithm/ranges_find_first_of.h> +# include <__algorithm/ranges_find_if.h> +# include <__algorithm/ranges_find_if_not.h> +# include <__algorithm/ranges_for_each.h> +# include <__algorithm/ranges_for_each_n.h> +# include <__algorithm/ranges_generate.h> +# include <__algorithm/ranges_generate_n.h> +# include <__algorithm/ranges_includes.h> +# include <__algorithm/ranges_inplace_merge.h> +# include <__algorithm/ranges_is_heap.h> +# include <__algorithm/ranges_is_heap_until.h> +# include <__algorithm/ranges_is_partitioned.h> +# include <__algorithm/ranges_is_permutation.h> +# include <__algorithm/ranges_is_sorted.h> +# include <__algorithm/ranges_is_sorted_until.h> +# include <__algorithm/ranges_lexicographical_compare.h> +# include <__algorithm/ranges_lower_bound.h> +# include <__algorithm/ranges_make_heap.h> +# include <__algorithm/ranges_max.h> +# include <__algorithm/ranges_max_element.h> +# include <__algorithm/ranges_merge.h> +# include <__algorithm/ranges_min.h> +# include <__algorithm/ranges_min_element.h> +# include <__algorithm/ranges_minmax.h> +# include <__algorithm/ranges_minmax_element.h> +# include <__algorithm/ranges_mismatch.h> +# include <__algorithm/ranges_move.h> +# include <__algorithm/ranges_move_backward.h> +# include <__algorithm/ranges_next_permutation.h> +# include <__algorithm/ranges_none_of.h> +# include <__algorithm/ranges_nth_element.h> +# include <__algorithm/ranges_partial_sort.h> +# include <__algorithm/ranges_partial_sort_copy.h> +# include <__algorithm/ranges_partition.h> +# include <__algorithm/ranges_partition_copy.h> +# include <__algorithm/ranges_partition_point.h> +# include <__algorithm/ranges_pop_heap.h> +# include <__algorithm/ranges_prev_permutation.h> +# include <__algorithm/ranges_push_heap.h> +# include <__algorithm/ranges_remove.h> +# include <__algorithm/ranges_remove_copy.h> +# include <__algorithm/ranges_remove_copy_if.h> +# include <__algorithm/ranges_remove_if.h> +# include <__algorithm/ranges_replace.h> +# include <__algorithm/ranges_replace_copy.h> +# include <__algorithm/ranges_replace_copy_if.h> +# include <__algorithm/ranges_replace_if.h> +# include <__algorithm/ranges_reverse.h> +# include <__algorithm/ranges_reverse_copy.h> +# include <__algorithm/ranges_rotate.h> +# include <__algorithm/ranges_rotate_copy.h> +# include <__algorithm/ranges_sample.h> +# include <__algorithm/ranges_search.h> +# include <__algorithm/ranges_search_n.h> +# include <__algorithm/ranges_set_difference.h> +# include <__algorithm/ranges_set_intersection.h> +# include <__algorithm/ranges_set_symmetric_difference.h> +# include <__algorithm/ranges_set_union.h> +# include <__algorithm/ranges_shuffle.h> +# include <__algorithm/ranges_sort.h> +# include <__algorithm/ranges_sort_heap.h> +# include <__algorithm/ranges_stable_partition.h> +# include <__algorithm/ranges_stable_sort.h> +# include <__algorithm/ranges_swap_ranges.h> +# include <__algorithm/ranges_transform.h> +# include <__algorithm/ranges_unique.h> +# include <__algorithm/ranges_unique_copy.h> +# include <__algorithm/ranges_upper_bound.h> +# include <__algorithm/shift_left.h> +# include <__algorithm/shift_right.h> +#endif + +#if _LIBCPP_STD_VER >= 23 +# include <__algorithm/fold.h> +# include <__algorithm/ranges_contains_subrange.h> +# include <__algorithm/ranges_ends_with.h> +# include <__algorithm/ranges_starts_with.h> +#endif // _LIBCPP_STD_VER >= 23 + +#include + // standard-mandated includes // [algorithm.syn] @@ -2013,6 +2018,10 @@ template # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14 +# include +#endif + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # include diff --git a/libcxx/include/bit b/libcxx/include/bit index b8e4bdc2dfe202..94387d101a398f 100644 --- a/libcxx/include/bit +++ b/libcxx/include/bit @@ -61,26 +61,36 @@ namespace std { */ -#include <__bit/bit_cast.h> -#include <__bit/bit_ceil.h> -#include <__bit/bit_floor.h> -#include <__bit/bit_log2.h> -#include <__bit/bit_width.h> -#include <__bit/blsr.h> -#include <__bit/byteswap.h> -#include <__bit/countl.h> -#include <__bit/countr.h> -#include <__bit/endian.h> -#include <__bit/has_single_bit.h> -#include <__bit/popcount.h> -#include <__bit/rotate.h> #include <__config> + +#if _LIBCPP_STD_VER >= 20 +# include <__bit/bit_cast.h> +# include <__bit/bit_ceil.h> +# include <__bit/bit_floor.h> +# include <__bit/bit_log2.h> +# include <__bit/bit_width.h> +# include <__bit/countl.h> +# include <__bit/countr.h> +# include <__bit/endian.h> +# include <__bit/has_single_bit.h> +# include <__bit/popcount.h> +# include <__bit/rotate.h> +#endif + +#if _LIBCPP_STD_VER >= 23 +# include <__bit/byteswap.h> +#endif + #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 +# include +#endif + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # include diff --git a/libcxx/include/charconv b/libcxx/include/charconv index 5bc7b9011be024..a2e270e9316dc7 100644 --- a/libcxx/include/charconv +++ b/libcxx/include/charconv @@ -69,18 +69,21 @@ namespace std { */ -#include <__charconv/chars_format.h> -#include <__charconv/from_chars_integral.h> -#include <__charconv/from_chars_result.h> -#include <__charconv/tables.h> -#include <__charconv/to_chars.h> -#include <__charconv/to_chars_base_10.h> -#include <__charconv/to_chars_floating_point.h> -#include <__charconv/to_chars_integral.h> -#include <__charconv/to_chars_result.h> -#include <__charconv/traits.h> #include <__config> -#include <__system_error/errc.h> + +#if _LIBCPP_STD_VER >= 17 +# include <__charconv/chars_format.h> +# include <__charconv/from_chars_integral.h> +# include <__charconv/from_chars_result.h> +# include <__charconv/tables.h> +# include <__charconv/to_chars.h> +# include <__charconv/to_chars_base_10.h> +# include <__charconv/to_chars_floating_point.h> +# include <__charconv/to_chars_integral.h> +# include <__charconv/to_chars_result.h> +# include <__charconv/traits.h> +#endif // _LIBCPP_STD_VER >= 17 + #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -91,6 +94,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14 +# include +# include +# include +# include +#endif + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # include diff --git a/libcxx/include/chrono b/libcxx/include/chrono index 5eddd050196dec..513ae52006e890 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -880,28 +880,48 @@ constexpr chrono::year operator ""y(unsigned lo // clang-format on -#include <__chrono/calendar.h> -#include <__chrono/convert_to_timespec.h> -#include <__chrono/convert_to_tm.h> -#include <__chrono/day.h> +#include <__config> + #include <__chrono/duration.h> #include <__chrono/file_clock.h> -#include <__chrono/hh_mm_ss.h> #include <__chrono/high_resolution_clock.h> -#include <__chrono/literals.h> -#include <__chrono/month.h> -#include <__chrono/month_weekday.h> -#include <__chrono/monthday.h> #include <__chrono/steady_clock.h> -#include <__chrono/sys_info.h> #include <__chrono/system_clock.h> #include <__chrono/time_point.h> -#include <__chrono/weekday.h> -#include <__chrono/year.h> -#include <__chrono/year_month.h> -#include <__chrono/year_month_day.h> -#include <__chrono/year_month_weekday.h> -#include <__config> + +#if _LIBCPP_STD_VER >= 20 +# include <__chrono/calendar.h> +# include <__chrono/day.h> +# include <__chrono/hh_mm_ss.h> +# include <__chrono/literals.h> +# include <__chrono/month.h> +# include <__chrono/month_weekday.h> +# include <__chrono/monthday.h> +# include <__chrono/sys_info.h> +# include <__chrono/weekday.h> +# include <__chrono/year.h> +# include <__chrono/year_month.h> +# include <__chrono/year_month_day.h> +# include <__chrono/year_month_weekday.h> + +# if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include <__chrono/formatter.h> +# include <__chrono/ostream.h> +# include <__chrono/parser_std_format_spec.h> +# include <__chrono/statically_widen.h> +# endif + +# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \ + !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include <__chrono/leap_second.h> +# include <__chrono/time_zone.h> +# include <__chrono/time_zone_link.h> +# include <__chrono/tzdb.h> +# include <__chrono/tzdb_list.h> +# endif + +#endif + #include // standard-mandated includes @@ -909,26 +929,17 @@ constexpr chrono::year operator ""y(unsigned lo // [time.syn] #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && _LIBCPP_STD_VER >= 20 -# include <__chrono/formatter.h> -# include <__chrono/ostream.h> -# include <__chrono/parser_std_format_spec.h> -# include <__chrono/statically_widen.h> -#endif - -#if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \ - !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include <__chrono/leap_second.h> -# include <__chrono/time_zone.h> -# include <__chrono/time_zone_link.h> -# include <__chrono/tzdb.h> -# include <__chrono/tzdb_list.h> -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 +# include +# include +# include +# include +#endif + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # include diff --git a/libcxx/include/compare b/libcxx/include/compare index 93953254b78436..8a41835b148978 100644 --- a/libcxx/include/compare +++ b/libcxx/include/compare @@ -140,26 +140,36 @@ namespace std { } */ -#include <__compare/common_comparison_category.h> -#include <__compare/compare_partial_order_fallback.h> -#include <__compare/compare_strong_order_fallback.h> -#include <__compare/compare_three_way.h> -#include <__compare/compare_three_way_result.h> -#include <__compare/compare_weak_order_fallback.h> -#include <__compare/is_eq.h> -#include <__compare/ordering.h> -#include <__compare/partial_order.h> -#include <__compare/strong_order.h> -#include <__compare/synth_three_way.h> -#include <__compare/three_way_comparable.h> -#include <__compare/weak_order.h> #include <__config> + +#if _LIBCPP_STD_VER >= 20 +# include <__compare/common_comparison_category.h> +# include <__compare/compare_partial_order_fallback.h> +# include <__compare/compare_strong_order_fallback.h> +# include <__compare/compare_three_way.h> +# include <__compare/compare_three_way_result.h> +# include <__compare/compare_weak_order_fallback.h> +# include <__compare/is_eq.h> +# include <__compare/ordering.h> +# include <__compare/partial_order.h> +# include <__compare/strong_order.h> +# include <__compare/synth_three_way.h> +# include <__compare/three_way_comparable.h> +# include <__compare/weak_order.h> +#endif // _LIBCPP_STD_VER >= 20 + #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 +# include +# include +# include +#endif + #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # include diff --git a/libcxx/include/concepts b/libcxx/include/concepts index e10f5ab5ad8a18..e89d216a593725 100644 --- a/libcxx/include/concepts +++ b/libcxx/include/concepts @@ -129,31 +129,39 @@ namespace std { */ -#include <__concepts/arithmetic.h> -#include <__concepts/assignable.h> -#include <__concepts/boolean_testable.h> -#include <__concepts/class_or_enum.h> -#include <__concepts/common_reference_with.h> -#include <__concepts/common_with.h> -#include <__concepts/constructible.h> -#include <__concepts/convertible_to.h> -#include <__concepts/copyable.h> -#include <__concepts/derived_from.h> -#include <__concepts/destructible.h> -#include <__concepts/different_from.h> -#include <__concepts/equality_comparable.h> -#include <__concepts/invocable.h> -#include <__concepts/movable.h> -#include <__concepts/predicate.h> -#include <__concepts/regular.h> -#include <__concepts/relation.h> -#include <__concepts/same_as.h> -#include <__concepts/semiregular.h> -#include <__concepts/swappable.h> -#include <__concepts/totally_ordered.h> #include <__config> + +#if _LIBCPP_STD_VER >= 20 +# include <__concepts/arithmetic.h> +# include <__concepts/assignable.h> +# include <__concepts/boolean_testable.h> +# include <__concepts/class_or_enum.h> +# include <__concepts/common_reference_with.h> +# include <__concepts/common_with.h> +# include <__concepts/constructible.h> +# include <__concepts/convertible_to.h> +# include <__concepts/copyable.h> +# include <__concepts/derived_from.h> +# include <__concepts/destructible.h> +# include <__concepts/different_from.h> +# include <__concepts/equality_comparable.h> +# include <__concepts/invocable.h> +# include <__concepts/movable.h> +# include <__concepts/predicate.h> +# include <__concepts/regular.h> +# include <__concepts/relation.h> +# include <__concepts/same_as.h> +# include <__concepts/semiregular.h> +# include <__concepts/swappable.h> +# include <__concepts/totally_ordered.h> +#endif // _LIBCPP_STD_VER >= 20 + #include +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 +# include +#endif + #if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) # include #endif diff --git a/libcxx/include/coroutine b/libcxx/include/coroutine index b1ba83b541b4b7..d1a44e2e12dd41 100644 --- a/libcxx/include/coroutine +++ b/libcxx/include/coroutine @@ -39,10 +39,14 @@ struct suspend_always; */ #include <__config> + +#if _LIBCPP_STD_VER >= 20 #include <__coroutine/coroutine_handle.h> #include <__coroutine/coroutine_traits.h> #include <__coroutine/noop_coroutine_handle.h> #include <__coroutine/trivial_awaitables.h> +#endif // _LIBCPP_STD_VER >= 20 + #include // standard-mandated includes diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap index 372219e8f83636..ccee7029824e33 100644 --- a/libcxx/include/module.modulemap +++ b/libcxx/include/module.modulemap @@ -1123,7 +1123,10 @@ module std_private_charconv_to_chars [system] { header "__charcon module std_private_charconv_to_chars_base_10 [system] { header "__charconv/to_chars_base_10.h" } module std_private_charconv_to_chars_floating_point [system] { header "__charconv/to_chars_floating_point.h" } module std_private_charconv_to_chars_integral [system] { header "__charconv/to_chars_integral.h" } -module std_private_charconv_to_chars_result [system] { header "__charconv/to_chars_result.h" } +module std_private_charconv_to_chars_result [system] { + header "__charconv/to_chars_result.h" + export * +} module std_private_charconv_traits [system] { header "__charconv/traits.h" } module std_private_chrono_calendar [system] { header "__chrono/calendar.h" } diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf index aec537866c2031..7964758c908f4c 100644 --- a/libcxx/include/streambuf +++ b/libcxx/include/streambuf @@ -109,6 +109,7 @@ protected: #include <__config> #include <__fwd/streambuf.h> +#include <__locale> #include <__type_traits/is_same.h> #include #include diff --git a/libcxx/test/libcxx/algorithms/half_positive.pass.cpp b/libcxx/test/libcxx/algorithms/half_positive.pass.cpp index 82d18cba37f34c..40f46974195720 100644 --- a/libcxx/test/libcxx/algorithms/half_positive.pass.cpp +++ b/libcxx/test/libcxx/algorithms/half_positive.pass.cpp @@ -11,10 +11,10 @@ // __half_positive divides an integer number by 2 as unsigned number for known types. // It can be an important optimization for lower bound, for example. -#include +#include <__algorithm/half_positive.h> #include +#include #include -#include #include "test_macros.h" #include "user_defined_integral.h" diff --git a/libcxx/test/libcxx/numerics/bit.ops.pass.cpp b/libcxx/test/libcxx/numerics/bit.ops.pass.cpp index d3ca8b2f8030bd..7f502d6e01d1ea 100644 --- a/libcxx/test/libcxx/numerics/bit.ops.pass.cpp +++ b/libcxx/test/libcxx/numerics/bit.ops.pass.cpp @@ -9,7 +9,9 @@ // Test the __XXXX routines in the header. // These are not supposed to be exhaustive tests, just sanity checks. -#include +#include <__bit/bit_log2.h> +#include <__bit/countl.h> +#include <__bit/rotate.h> #include #include "test_macros.h" diff --git a/libcxx/test/libcxx/time/convert_to_tm.pass.cpp b/libcxx/test/libcxx/time/convert_to_tm.pass.cpp index 708d2c3ff7c29e..908a38dec83d22 100644 --- a/libcxx/test/libcxx/time/convert_to_tm.pass.cpp +++ b/libcxx/test/libcxx/time/convert_to_tm.pass.cpp @@ -15,6 +15,7 @@ // Most of the code is tested indirectly in the chrono formatters. This only // tests the hour overflow. +#include <__chrono/convert_to_tm.h> #include #include #include diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv index 2e246644f626cc..c2250899a8002b 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx03.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv @@ -7,7 +7,6 @@ algorithm cstdint algorithm cstdlib algorithm cstring algorithm cwchar -algorithm execution algorithm initializer_list algorithm iosfwd algorithm iterator @@ -777,10 +776,21 @@ stop_token limits stop_token ratio stop_token type_traits stop_token version +streambuf cctype streambuf climits +streambuf clocale +streambuf cstddef streambuf cstdint +streambuf cstdlib +streambuf cstring +streambuf cwchar +streambuf initializer_list streambuf ios streambuf iosfwd +streambuf limits +streambuf new +streambuf string +streambuf typeinfo streambuf version string algorithm string climits diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv index e074bf1f7dcc8d..3e929e8f940967 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx11.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv @@ -7,7 +7,6 @@ algorithm cstdint algorithm cstdlib algorithm cstring algorithm cwchar -algorithm execution algorithm initializer_list algorithm iosfwd algorithm iterator @@ -783,10 +782,22 @@ stop_token limits stop_token ratio stop_token type_traits stop_token version +streambuf cctype streambuf climits +streambuf clocale +streambuf cstddef streambuf cstdint +streambuf cstdlib +streambuf cstring +streambuf cwchar +streambuf initializer_list streambuf ios streambuf iosfwd +streambuf limits +streambuf new +streambuf string +streambuf tuple +streambuf typeinfo streambuf version string algorithm string climits diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv index 88f9c24f086462..422db19b6bb8ac 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx14.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv @@ -785,10 +785,22 @@ stop_token limits stop_token ratio stop_token type_traits stop_token version +streambuf cctype streambuf climits +streambuf clocale +streambuf cstddef streambuf cstdint +streambuf cstdlib +streambuf cstring +streambuf cwchar +streambuf initializer_list streambuf ios streambuf iosfwd +streambuf limits +streambuf new +streambuf string +streambuf tuple +streambuf typeinfo streambuf version string algorithm string climits diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv index 88f9c24f086462..422db19b6bb8ac 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx17.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv @@ -785,10 +785,22 @@ stop_token limits stop_token ratio stop_token type_traits stop_token version +streambuf cctype streambuf climits +streambuf clocale +streambuf cstddef streambuf cstdint +streambuf cstdlib +streambuf cstring +streambuf cwchar +streambuf initializer_list streambuf ios streambuf iosfwd +streambuf limits +streambuf new +streambuf string +streambuf tuple +streambuf typeinfo streambuf version string algorithm string climits diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv index 27f59660fb98dc..6b80790a9d19b5 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx20.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv @@ -795,10 +795,22 @@ stop_token limits stop_token ratio stop_token type_traits stop_token version +streambuf cctype streambuf climits +streambuf clocale +streambuf cstddef streambuf cstdint +streambuf cstdlib +streambuf cstring +streambuf cwchar +streambuf initializer_list streambuf ios streambuf iosfwd +streambuf limits +streambuf new +streambuf string +streambuf tuple +streambuf typeinfo streambuf version string algorithm string climits diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv index 9ae422a31f074e..ea01e413458500 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx23.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv @@ -541,9 +541,22 @@ stop_token ctime stop_token limits stop_token ratio stop_token version +streambuf cctype streambuf climits +streambuf clocale +streambuf cstddef +streambuf cstdint +streambuf cstdlib +streambuf cstring +streambuf cwchar +streambuf initializer_list streambuf ios streambuf iosfwd +streambuf limits +streambuf new +streambuf string +streambuf tuple +streambuf typeinfo streambuf version string climits string compare diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv index 9ae422a31f074e..ea01e413458500 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx26.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv @@ -541,9 +541,22 @@ stop_token ctime stop_token limits stop_token ratio stop_token version +streambuf cctype streambuf climits +streambuf clocale +streambuf cstddef +streambuf cstdint +streambuf cstdlib +streambuf cstring +streambuf cwchar +streambuf initializer_list streambuf ios streambuf iosfwd +streambuf limits +streambuf new +streambuf string +streambuf tuple +streambuf typeinfo streambuf version string climits string compare From 00162162dd853795c532afa5dec4dc4e798d4a4b Mon Sep 17 00:00:00 2001 From: YunQiang Su Date: Sun, 14 Apr 2024 23:16:52 +0800 Subject: [PATCH 08/10] CompilerRT: Normalize COMPILER_RT_DEFAULT_TARGET_TRIPLE (#88407) If LLVM is configured with -DLLVM_DEFAULT_TARGET_TRIPLE, and the argument is not normalized, such as Debian-style vendor-less triple, clang will try to find libclang_rt in lib/, while libclang_rt is placed into lib/. Let's also place libclang_rt into lib/. --- .../cmake/Modules/CompilerRTUtils.cmake | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake index e8e5f612d5b03c..75f111efeb102f 100644 --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -362,10 +362,22 @@ macro(construct_compiler_rt_default_triple) message(FATAL_ERROR "CMAKE_C_COMPILER_TARGET must also be set when COMPILER_RT_DEFAULT_TARGET_ONLY is ON") endif() message(STATUS "cmake c compiler target: ${CMAKE_C_COMPILER_TARGET}") - set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${CMAKE_C_COMPILER_TARGET}) + if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") + execute_process(COMMAND ${CMAKE_C_COMPILER} --target=${CMAKE_C_COMPILER_TARGET} -print-effective-triple + OUTPUT_VARIABLE COMPILER_RT_DEFAULT_TARGET_TRIPLE + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() + set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${CMAKE_C_COMPILER_TARGET}) + endif() else() - set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${LLVM_TARGET_TRIPLE} CACHE STRING - "Default triple for which compiler-rt runtimes will be built.") + if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") + execute_process(COMMAND ${CMAKE_C_COMPILER} --target=${LLVM_TARGET_TRIPLE} -print-effective-triple + OUTPUT_VARIABLE COMPILER_RT_DEFAULT_TARGET_TRIPLE + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() + set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${LLVM_TARGET_TRIPLE} CACHE STRING + "Default triple for which compiler-rt runtimes will be built.") + endif() endif() string(REPLACE "-" ";" LLVM_TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE}) From 5927492e8e68c1ee5a0d84cf6c402a900aac4a3c Mon Sep 17 00:00:00 2001 From: YunQiang Su Date: Mon, 15 Apr 2024 00:12:42 +0800 Subject: [PATCH 09/10] Revert "CompilerRT: Normalize COMPILER_RT_DEFAULT_TARGET_TRIPLE" (#88663) Reverts llvm/llvm-project#88407 --- .../cmake/Modules/CompilerRTUtils.cmake | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake index 75f111efeb102f..e8e5f612d5b03c 100644 --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -362,22 +362,10 @@ macro(construct_compiler_rt_default_triple) message(FATAL_ERROR "CMAKE_C_COMPILER_TARGET must also be set when COMPILER_RT_DEFAULT_TARGET_ONLY is ON") endif() message(STATUS "cmake c compiler target: ${CMAKE_C_COMPILER_TARGET}") - if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") - execute_process(COMMAND ${CMAKE_C_COMPILER} --target=${CMAKE_C_COMPILER_TARGET} -print-effective-triple - OUTPUT_VARIABLE COMPILER_RT_DEFAULT_TARGET_TRIPLE - OUTPUT_STRIP_TRAILING_WHITESPACE) - else() - set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${CMAKE_C_COMPILER_TARGET}) - endif() + set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${CMAKE_C_COMPILER_TARGET}) else() - if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") - execute_process(COMMAND ${CMAKE_C_COMPILER} --target=${LLVM_TARGET_TRIPLE} -print-effective-triple - OUTPUT_VARIABLE COMPILER_RT_DEFAULT_TARGET_TRIPLE - OUTPUT_STRIP_TRAILING_WHITESPACE) - else() - set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${LLVM_TARGET_TRIPLE} CACHE STRING - "Default triple for which compiler-rt runtimes will be built.") - endif() + set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${LLVM_TARGET_TRIPLE} CACHE STRING + "Default triple for which compiler-rt runtimes will be built.") endif() string(REPLACE "-" ";" LLVM_TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE}) From b8d0cba14bcfc5c1c2f7a878ad9eaa12b6a590b6 Mon Sep 17 00:00:00 2001 From: Cyndy Ishida Date: Sun, 14 Apr 2024 09:23:42 -0700 Subject: [PATCH 10/10] [TextAPI] Apply NFC code fixups (#88639) * Remove unnecessary cast * Annotate `#endif` --- llvm/include/llvm/TextAPI/Utils.h | 2 +- llvm/lib/TextAPI/BinaryReader/DylibReader.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/TextAPI/Utils.h b/llvm/include/llvm/TextAPI/Utils.h index 319e0abce25b03..ebfe88984f8034 100644 --- a/llvm/include/llvm/TextAPI/Utils.h +++ b/llvm/include/llvm/TextAPI/Utils.h @@ -21,7 +21,7 @@ #if !defined(PATH_MAX) #define PATH_MAX 1024 -#endif +#endif // !defined(PATH_MAX) #define MACCATALYST_PREFIX_PATH "/System/iOSSupport" #define DRIVERKIT_PREFIX_PATH "/System/DriverKit" diff --git a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp index f92a2d19a63fc2..ec0271f774ecc5 100644 --- a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp +++ b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp @@ -484,7 +484,7 @@ accumulateLocs(MachOObjectFile &Obj, auto Sym = parseSymbol(Name); if (!File.empty() && Line != 0) - LocMap.insert({Sym.Name.str(), RecordLoc(File, Line)}); + LocMap.insert({Sym.Name, RecordLoc(File, Line)}); } return LocMap;