aboutsummaryrefslogtreecommitdiff
path: root/libcxx/test/std/numerics
AgeCommit message (Collapse)AuthorFilesLines
5 days[libc++][C++03] cherry-pick #104773 (#158244)Nikolas Klauser1-2/+0
5 days[libc++][C++03] cherry-pick #106566 (#158250)Nikolas Klauser1-2/+0
2025-09-04[libc++][NFC] Use llvm.org/PR to link to bug reports (#156288)Nikolas Klauser4-6/+4
We've built up quite a few links directly to github within the code base. We should instead use `llvm.org/PR<issue-number>` to link to bugs, since that is resilient to the bug tracker changing in the future. This is especially relevant for tests linking to bugs, since they will probably be there for decades to come. A nice side effect is that these links are significantly shorter than the GH links, making them much less of an eyesore. This patch also replaces a few links that linked to the old bugzilla instance on llvm.org.
2025-08-25[libcxx][test] Fix typos (#155217)Stephan T. Lavavej11-11/+11
I noticed a typo in the directory name `refwrap.comparissons`, then did a quick pass to fix typos elsewhere in the tests. All fixes were manual (some carefully search-and-replaced); I used [cspell](https://www.npmjs.com/package/cspell) to find them.
2025-08-09[clang] Improve nested name specifier AST representation (#147835)Matheus Izvekov1-1/+1
This is a major change on how we represent nested name qualifications in the AST. * The nested name specifier itself and how it's stored is changed. The prefixes for types are handled within the type hierarchy, which makes canonicalization for them super cheap, no memory allocation required. Also translating a type into nested name specifier form becomes a no-op. An identifier is stored as a DependentNameType. The nested name specifier gains a lightweight handle class, to be used instead of passing around pointers, which is similar to what is implemented for TemplateName. There is still one free bit available, and this handle can be used within a PointerUnion and PointerIntPair, which should keep bit-packing aficionados happy. * The ElaboratedType node is removed, all type nodes in which it could previously apply to can now store the elaborated keyword and name qualifier, tail allocating when present. * TagTypes can now point to the exact declaration found when producing these, as opposed to the previous situation of there only existing one TagType per entity. This increases the amount of type sugar retained, and can have several applications, for example in tracking module ownership, and other tools which care about source file origins, such as IWYU. These TagTypes are lazily allocated, in order to limit the increase in AST size. This patch offers a great performance benefit. It greatly improves compilation time for [stdexec](https://github.com/NVIDIA/stdexec). For one datapoint, for `test_on2.cpp` in that project, which is the slowest compiling test, this patch improves `-c` compilation time by about 7.2%, with the `-fsyntax-only` improvement being at ~12%. This has great results on compile-time-tracker as well: ![image](https://github.com/user-attachments/assets/700dce98-2cab-4aa8-97d1-b038c0bee831) This patch also further enables other optimziations in the future, and will reduce the performance impact of template specialization resugaring when that lands. It has some other miscelaneous drive-by fixes. About the review: Yes the patch is huge, sorry about that. Part of the reason is that I started by the nested name specifier part, before the ElaboratedType part, but that had a huge performance downside, as ElaboratedType is a big performance hog. I didn't have the steam to go back and change the patch after the fact. There is also a lot of internal API changes, and it made sense to remove ElaboratedType in one go, versus removing it from one type at a time, as that would present much more churn to the users. Also, the nested name specifier having a different API avoids missing changes related to how prefixes work now, which could make existing code compile but not work. How to review: The important changes are all in `clang/include/clang/AST` and `clang/lib/AST`, with also important changes in `clang/lib/Sema/TreeTransform.h`. The rest and bulk of the changes are mostly consequences of the changes in API. PS: TagType::getDecl is renamed to `getOriginalDecl` in this patch, just for easier to rebasing. I plan to rename it back after this lands. Fixes #136624 Fixes https://github.com/llvm/llvm-project/issues/43179 Fixes https://github.com/llvm/llvm-project/issues/68670 Fixes https://github.com/llvm/llvm-project/issues/92757
2025-08-05[libc++] Workaround for a bug of overloads in MS UCRT's `<math.h>` (#149234)A. Jiang1-5/+0
MS UCRT seems confused on the status of LWG1327, and still provides pre-LWG1327 overload set the related math functions, which can't handle integer types as required. It is probably that UCRT won't fixed this in a near future, per https://developercommunity.visualstudio.com/t/10294165. Before C++20, libc++ worked around this bug by relying on `-fdelayed-template-parsing`. However, this non-conforming option is off by default since C++20. I think we should use `requires` instead. --------- Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-07-21[libc++] Remove mentions of Clang 18 in the test suite (#148862)Louis Dionne1-1/+1
Clang 19 has been the oldest supported version of Clang since the LLVM 20 release, but we had not cleaned up the test suite yet.
2025-07-18[libc++][tests] Update XFAIL annotations for some tests on Windows (#149124)Paul Kirth1-3/+4
These tests still fail on Windows with clang-22, as reported in #70225. This started failing due to the version bump to Clang 22.
2025-07-17[libc++] Move more tests into better places (#148419)Nikolas Klauser3-0/+188
2025-07-15[libc++] Bump Xcode support (#148651)Louis Dionne6-6/+6
Libc++'s policy is to support only the latest released Xcode, which is Xcode 16.x. We did update our CI jobs to Xcode 16.x, but we forgot to update the documentation, which still mentioned Xcode 15. This patch updates the documentation and cleans up outdated mentions of apple-clang-15 in the test suite.
2025-06-24[libc++] Fix no-localisation CI failure on <complex> (#145213)Hui2-2/+2
2025-06-19[libc++][NFC] Format abs.pass.cpp testNikolas Klauser1-43/+37
I will modify the test in an upcoming PR. I'm formatting it now to avoid a bunch of whitespace changes in that PR.
2025-06-19[libc++] Move std::abs into __math/abs.h (#139586)Nikolas Klauser1-2/+2
`template <class = int>` is also added to our implementations to avoid an ambiguity between the libc's version and our version when both are visible. This avoids including `<stdlib.h>` in `<math.h>`.
2025-06-11[libc++] Upgrade to GCC 15 (#138293)Nikolas Klauser2-0/+6
2025-04-05[libc++] Implement ranges::iota (#68494)James E T Smith1-0/+215
# Overview As a disclaimer, this is my first PR to LLVM and while I've tried to ensure I've followed the LLVM and libc++ contributing guidelines, there's probably a good chance I missed something. If I have, just let me know and I'll try to correct it as soon as I can. This PR implements `std::ranges::iota` and `std::ranges::out_value_result` outlined in [P2440r1](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2440r1.html). As outlined in the paper above, I've: - Implemented `out_value_result` and added to `<algorithm>` - Added `out_value_result`, `iota_result`, and two overloads of `iota` to `std::ranges` in `<numeric>` - Updated the version macro `__cpp_lib_ranges_iota` in `<version>` I've also added tests for `ranges::iota` and `ranges::out_value_result`. Lastly, I added those structs to the appropriate module files. Partially implements #105184 EDIT: Forgot to mention in the original post, thanks to @hawkinsw for taking a look at a preliminary version of this PR! # TODOs - [x] Updating the range [status doc](https://github.com/jamesETsmith/llvm-project/blob/main/libcxx/docs/Status/RangesMajorFeatures.csv) - [x] Ensure all comments from https://reviews.llvm.org/D121436 are addressed here - [X] EDIT (I'll do this in a separate PR). ~~I'm open to implementing the rest of P2440r1 (`ranges::shift_left` and `ranges::shift_right`) if that's ok, I just wanted to get feedback on `ranges::iota` first~~ - [x] I've been having trouble building the modules locally and want to make sure that's working properly Closes: #134060
2025-03-24[libc++] Remove one of the std::signbit overloads (#130505)Nikolas Klauser1-0/+3
We'e specialized `std::signbit` for signed and unsigned integral types seperately, even though the optimizer can trivially figure out that `unsigned_value < 0` always false is. This patch removes the specialization, since there is really not much of a benefit to it.
2025-03-20[libc++][test] Fix issues found by MSVC's STL (#131787)Stephan T. Lavavej1-1/+1
* libcxx/test/support/min_allocator.h + Fix `tiny_size_allocator::rebind` which mistakenly said `T` instead of `U`. * libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp + `std::stable_partition` requires bidirectional iterators. * libcxx/test/std/containers/sequences/vector.bool/max_size.pass.cpp + Fix allocator type given to `std::vector<bool>`. The element types are required to match, [N5008](https://isocpp.org/files/papers/N5008.pdf) \[container.alloc.reqmts\]/5: "*Mandates:* `allocator_type::value_type` is the same as `X::value_type`." * libcxx/test/std/time/time.clock/time.clock.utc/types.compile.pass.cpp + Mark `is_steady` as `[[maybe_unused]]`, as it appears within `LIBCPP_STATIC_ASSERT` only. * libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp * libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp * libcxx/test/std/utilities/utility/utility.swap/swap_array.pass.cpp + Fix MSVC warning C4127 "conditional expression is constant". `TEST_STD_AT_LEAST_23_OR_RUNTIME_EVALUATED` was introduced for this purpose, so it should be used consistently. * libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp + Fix `gcd()` precondition violation for `signed char`. This test case was causing `-128` to be passed as a `signed char` to `gcd()`, which is forbidden. * libcxx/test/std/containers/sequences/array/assert.iterators.pass.cpp * libcxx/test/std/containers/sequences/vector/vector.modifiers/assert.push_back.invalidation.pass.cpp * libcxx/test/std/input.output/iostream.format/print.fun/no_file_description.pass.cpp + Split some REQUIRES and XFAIL lines. This is a "nice to have" for MSVC's internal test harness, which is extremely simple and looks for exact comment matches to skip tests. We can recognize the specific lines "REQUIRES: has-unix-headers" and "XFAIL: msvc", but it's a headache to maintain if they're chained with other conditions. * libcxx/test/support/sized_allocator.h + Fix x86 truncation warnings. `std::allocator` takes `std::size_t`, so we need to `static_cast`. * libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/offset_range.pass.cpp + Fix x86 truncation warning. `std::min()` is returning `std::streamoff`, which was being unnecessarily narrowed to `std::size_t`. * libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp + Fix MSVC warning C4127 "conditional expression is constant" for an always-true branch. This was very recently introduced by #129008 making `N` constexpr. As it's a local constant just nine lines above, we don't need to test whether 100 is greater than 0.
2025-03-17[libc++][NFC] Fix incorrect main() signaturesLouis Dionne1-1/+3
2025-03-16[libc++][numeric][NFC] Cleanup *Saturation arithmetic* tests (#101826)Hristo Hristov11-95/+96
This simplifies the tests a little bit: Fixed -> TODO(LLVM20): remove [[maybe_unused]] and `{}` scope since all supported compilers support "Placeholder variables with no name" *IMPORTANT: Requires Apple Clang with [P2169R4: A nice placeholder with no name](https://wg21.link/P2169R4)* --------- Co-authored-by: Hristo Hristov <zingam@outlook.com>
2025-03-02[libc++] Add tests for gcd that result in something other than zero or one ↵AdityaK1-1/+13
(#129395) @colincross identified gcd does not have a single case whose answer is not 0, 1, or the smaller of the two inputs.
2025-01-30[libc++] Forward-proof some tests for AppleClang 17Louis Dionne1-1/+1
2025-01-29[libc++] Add clang-21 to failing tests on Windows (#124955)gulfemsavrun1-1/+1
After we switched to LLVM version 21, some libc++ tests started failing on Windows. This patch adds the clang-21 condition to XFAIL to fix the issue.
2025-01-28[libc++] Update the CI to Clang-20 and drop Clang-17 support (#117429)Nikolas Klauser1-1/+1
2024-12-21[libc++][C++03] Use `__cxx03/` headers in C++03 mode (#109002)Nikolas Klauser2-0/+4
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.
2024-12-06[libc++] Fix sub-overflow in std::gcd implementation (#117984)serge-sans-paille1-11/+1
Fix #117249
2024-10-31[libc++] Granularize <cstddef> includes (#108696)Nikolas Klauser10-25/+19
2024-10-30[libc++] Deprecate and remove meaningless `<cxxx>` headers (#111615)A. Jiang2-2/+6
This PR deprecates `<ccomplex>`, `<cstdbool>`, `<ctgmath>`, and `<ciso646>` in C++17 and "removes" them in C++20 by special deprecation warnings. `<cstdalign>` is previously missing. This PR also tries to add them, and then deprecates and "removes" `<cstdalign>`. Papers: - https://wg21.link/P0063R3 - https://wg21.link/P0619R4 Closes #99985. --------- Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2024-10-12[libc++][RFC] Always define internal feature test macros (#89178)Nikolas Klauser3-3/+3
Currently, the library-internal feature test macros are only defined if the feature is not available, and always have the prefix `_LIBCPP_HAS_NO_`. This patch changes that, so that they are always defined and have the prefix `_LIBCPP_HAS_` instead. This changes the canonical use of these macros to `#if _LIBCPP_HAS_FEATURE`, which means that using an undefined macro (e.g. due to a missing include) is diagnosed now. While this is rather unlikely currently, a similar change in `<__configuration/availability.h>` caught a few bugs. This also improves readability, since it removes the double-negation of `#ifndef _LIBCPP_HAS_NO_FEATURE`. The current patch only touches the macros defined in `<__config>`. If people are happy with this approach, I'll make a follow-up PR to also change the macros defined in `<__config_site>`.
2024-09-16[libc++][modules] Fix missing and incorrect includes (#108850)Louis Dionne43-58/+101
This patch adds a large number of missing includes in the libc++ headers and the test suite. Those were found as part of the effort to move towards a mostly monolithic top-level std module.
2024-09-12[libc++][math] Provide overloads for cv-unqualified floating point types for ↵Robin Caloudis1-0/+13
`std::signbit` (#106566) ## Why Following up on https://github.com/llvm/llvm-project/pull/105946, this patch provides the floating point overloads for `std::signbit` as defined by [P0533R9](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0533r9.pdf). ## What * Test and add overloads for cv-unqualified floating point types * Remove constrained overload as it is not needed anymore * Make use of `template<class = void>` as the universal C runtime (UCRT) needed for Clang-Cl comes with overloads for all cv-unqualified floating point types (float, double, long double) for `std::signbit()` by itself [in the WinSDK](https://github.com/microsoft/win32metadata/blob/e012b29924c53aa941fc010850b68331b0c3ea80/generation/WinSDK/RecompiledIdlHeaders/ucrt/corecrt_math.h#L309-L322). In a certain way, this can be seen as a deviation from the C standard. We need to work around it as the compilation would otherwise error out due to duplicated definitions.
2024-09-05[libc++][math] Add `constexpr` for `std::signbit()` (#105946)Robin Caloudis1-0/+78
## Why Since 18th of August, the floating point comparison builtin ``__builtin_signbit`` is available in Clang as constant expression (https://github.com/llvm/llvm-project/pull/94118). ## What * Implement `constexpr` for `std::signbit()` as defined by [P0533R9](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0533r9.pdf) (new C++23 feature) * Restrict execution of tests to tip-of-trunk Clang as builtin is not yet available (note that builtin is available in GCC)
2024-09-05[libc++][modules] Modularize <cstddef> (#107254)Louis Dionne11-0/+11
Many headers include `<cstddef>` just for size_t, and pulling in additional content (e.g. the traits used for std::byte) is unnecessary. To solve this problem, this patch splits up `<cstddef>` into subcomponents so that headers can include only the parts that they actually require. This has the added benefit of making the modules build a lot stricter with respect to IWYU, and also providing a canonical location where we define `std::size_t` and friends (which were previously defined in multiple headers like `<cstddef>` and `<ctime>`). After this patch, there's still many places in the codebase where we include `<cstddef>` when `<__cstddef/size_t.h>` would be sufficient. This patch focuses on removing `<cstddef>` includes from __type_traits to make these headers non-circular with `<cstddef>`. Additional refactorings can be tackled separately.
2024-08-30[libcxx][test] Add macro for when long double is just double (#106708)David Spickett1-1/+1
This removes the need for the long list of platforms in strong_order_long_double_verify.
2024-08-28[libc++][math] Provide overloads for cv-unqualified floating point types for ↵Robin Caloudis1-0/+14
`std::isnormal` (#104773) ## Why Currently, the following does not work when compiled with clang: ```c++ #include <cmath> struct ConvertibleToFloat { operator float(); }; bool test(ConvertibleToFloat x) { return std::isnormal(x); } ``` See https://godbolt.org/z/5bos8v67T for differences with respect to msvc, gcc or icx. It fails for `float`, `double` and `long double` (all cv-unqualified floating-point types). ## What Test and provide overloads as expected by the ISO C++ standard. The classification/comparison function `isnormal` is defined since C++11 until C++23 as ```c++ bool isnormal( float num ); bool isnormal( double num ); bool isnormal( long double num ); ``` and since C++23 as ```c++ constexpr bool isnormal( /* floating-point-type */ num ); ``` for which "the library provides overloads for all cv-unqualified floating-point types as the type of the parameter num". See §28.7.1/1 in the [ISO C++ standard](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4950.pdf) or check [cppreference](https://en.cppreference.com/w/cpp/numeric/math/isnormal).
2024-08-16[libc++][math] Fix acceptance of convertible types in `std::isnan()` and ↵Robin Caloudis3-9/+35
`std::isinf()` (#98952) Following up on https://github.com/llvm/llvm-project/pull/98841. Changes: - Properly test convertible types for `std::isnan()` and `std::inf()` - Tighten conditional in `cmath.pass.cpp` (Find insights on `_LIBCPP_PREFERRED_OVERLOAD` below) - Tighten preprocessor guard in `traits.h` Insights into why `_LIBCPP_PREFERRED_OVERLOAD` is needed: (i) When libc++ is layered on top of glibc on Linux, glibc's `math.h` is included. When compiling with `-std=c++03`, this header brings the function declaration of `isinf(double)` [1] and `isnan(double)` [2] into scope. This differs from the C99 Standard as only the macros `#define isnan(arg)` and `#define isinf(arg)` are expected. Therefore, libc++ needs to respect the presense of the `double` overload and cannot redefine it as it will conflict with the declaration already in scope. For `-std=c++11` and beyond this issue is fixed, as glibc guards both the `isinf` and `isnan` by preprocessor macros. (ii) When libc++ is layered on top of Bionic's libc, `math.h` exposes a function prototype for `isinf(double)` with return type `int`. This function prototype in Bionic's libc is not guarded by any preprocessor macros [3]. `_LIBCPP_PREFERRED_OVERLOAD` specifies that a given overload is a better match than an otherwise equally good function declaration. This is implemented in modern versions of Clang via `__attribute__((__enable_if__))`, and not elsewhere. See [4] for details. We use `_LIBCPP_PREFERRED_OVERLOAD` to define overloads in the global namespace that displace the overloads provided by the C libraries mentioned above. [1]: https://github.com/bminor/glibc/blob/fe9408087583fd7a6f61bb0dbcf2fd4e83186afa/math/bits/mathcalls.h#L185-L194 [2]: https://github.com/bminor/glibc/blob/fe9408087583fd7a6f61bb0dbcf2fd4e83186afa/math/bits/mathcalls.h#L222-L231 [3]: https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/math.h;l=322-323;drc=master?hl=fr-BE%22https:%2F%2Fsupport.google.com%2Fmerchants%2Fanswer%2F188494%5C%22%22https:%2F%2Fsupport.google.com%2Fmerchants%2Fanswer%2F188494%5C%22 [4]: https://github.com/llvm/llvm-project/commit/5fd17ab1b093f6b59aabb27f6c2c2278e65c2707
2024-08-14[libc++] Fix ambiguous constructors for std::complex and std::optional (#103409)Louis Dionne1-0/+38
Fixes #101960
2024-08-07[libcxx][test][z/OS] Fix hermite.pass.cpp for HEX float (#101019)Zibi Sarbinowski1-14/+29
The HEX float on z/OS does not have infinity nor NaN. In addition, the limits are smaller before the overflow occurs in mathematical calculations. This PR accounts for this. FYI, this LIT test was recently added in PR [89982](https://github.com/llvm/llvm-project/pull/89982)
2024-08-05[libc++][math] Fix undue overflowing of `std::hypot(x,y,z)` (#100820)PaulXiCao1-16/+75
This is in relation to mr #93350. It was merged to main, but reverted because of failing sanitizer builds on PowerPC. The fix includes replacing the hard-coded threshold constants (e.g. `__overflow_threshold`) for different floating-point sizes by a general computation using `std::ldexp`. Thus, it should now work for all architectures. This has the drawback of not being `constexpr` anymore as `std::ldexp` is not implemented as `constexpr` (even though the standard mandates it for C++23). Closes #92782
2024-08-03[libc++][bit] Improves rotate functions. (#98032)Mark de Wever2-0/+8
Investigating #96612 shows our implementation was different from the Standard and could cause UB. Testing the codegen showed quite a bit of assembly generated for these functions. The functions have been written differently which allows Clang to optimize the code to use simple CPU rotate instructions. Fixes: https://github.com/llvm/llvm-project/issues/96612
2024-07-31[libcxx][test] Require long_tests for eval.PR44847.pass.cp (#100722)David Spickett1-2/+2
This takes 1m40s to run when testing picolib on qemu. This isn't the end of the world but that's on an AArch64 server. So if someone felt the need to mark this unsupported in the first place, it's likely much slower on average hardware.
2024-07-24Revert "[libc++][math] Fix undue overflowing of `std::hypot(x,y,z)` (#93350)"Mitch Phillips1-75/+16
This reverts commit 9628777479a970db5d0c2d0b456dac6633864760. More details in https://github.com/llvm/llvm-project/pull/93350, but this broke the PowerPC sanitizer bots.
2024-07-23[libc++] Add clang-20 to failing tests on Windows (#100119)gulfemsavrun1-1/+1
After we switched to LLVM version 20, some libc++ tests started failing on Windows. This patch adds the clang-20 condition to XFAIL to fix the issue. The way that these tests are excluded from Windows are fragile and need to be updated every time we bump the LLVM version.
2024-07-23[libc++][math] Fix undue overflowing of `std::hypot(x,y,z)` (#93350)PaulXiCao1-16/+75
The 3-dimentionsional `std::hypot(x,y,z)` was sub-optimally implemented. This lead to possible over-/underflows in (intermediate) results which can be circumvented by this proposed change. The idea is to to scale the arguments (see linked issue for full discussion). Tests have been added for problematic over- and underflows. Closes #92782
2024-07-20[libc++][math] Mathematical Special Functions: Hermite Polynomial (#89982)PaulXiCao1-0/+341
Implementing the Hermite polynomials which are part of C++17's mathematical special functions. The goal is to get early feedback which will make implementing the other functions easier. Integration of functions in chunks (e.g. `std::hermite` at first, then `std::laguerre`, etc.) might make sense as well (also see note on boost.math below). I started out from this abandoned merge request: https://reviews.llvm.org/D58876 . The C++23 standard defines them in-terms of `/* floating-point type */` arguments. I have not looked into that. Note, there is still an ongoing discussion on discourse whether importing boost.math is an option.
2024-07-18[libc++] Fix acceptance of convertible-to-{float,double,long double} in ↵Robin Caloudis1-0/+12
std::isfinite() (#98841) Closes https://github.com/llvm/llvm-project/issues/98816.
2024-07-08[libc++] Add a test case for std::bit_cast with std::complex (#97751)Louis Dionne1-0/+36
This is extracted from #94620. While libc++ doesn't have the problem described in that issue, a test case is a good idea to ensure that we don't regress this behavior in the future. This could happen for example if we decide to use `_Complex` in the implementation of `std::complex` while Clang doesn't handle bit_cast with _Complex yet.
2024-07-05[libc++] Use _Complex for multiplication and division of complex floating ↵Nikolas Klauser4-16/+24
point types (#83575) This significantly simplifies the implementation and improves the codegen. The only downside is that the accuracy can be marginally worse, but that is up to the compiler to decide with this change, which means it can be controlled by compiler flags. Differential Revision: https://reviews.llvm.org/D155312
2024-06-28[libc++] Clean up and update deployment target features (#96312)Louis Dionne1-5/+2
This patch removes many annotations that are not relevant anymore since we don't support or test back-deploying to macOS < 10.13. It also cleans up raw usage of target triples to identify versions of dylibs shipped on prior versions of macOS, and uses the target-agnostic Lit features instead. Finally, it reorders both the Lit backdeployment features and the corresponding availability macros in the library in a way that makes more sense, and reformulates the Lit backdeployment features in terms of when a version of LLVM was introduced instead of encoding the system versions on which it hasn't been introduced yet. Although one can be derived from the other, encoding the negative form is extremely error-prone. Fixes #80901
2024-06-25[libc++] Fix incorrect overflow checking in std::lcm (#96310)Louis Dionne1-1/+26
We should have been using __builtin_mul_overflow from the start instead of adding a manual (and error-prone) check for overflow. Fixes #96196
2024-06-21[libc++] Fix deployment target Lit features (#94791)Louis Dionne1-2/+2
We were not making any distinction between e.g. the "Apple-flavored" libc++ built from trunk and the system-provided standard library on Apple platforms. For example, any test that would be XFAILed on a back-deployment target would unexpectedly pass when run on that deployment target against the tip of trunk Apple-flavored libc++. In reality, that test would be expected to pass because we're running against the latest libc++, even if it is Apple-flavored. To solve this issue, we introduce a new feature that describes whether the Standard Library in use is the one provided by the system by default, and that notion is different from the underlying standard library flavor. We also refactor the existing Lit features to make a distinction between availability markup and the library we're running against at runtime, which otherwise limit the flexibility of what we can express in the test suite. Finally, we refactor some of the back-deployment versions that were incorrect (such as thinking that LLVM 10 was introduced in macOS 11, when in reality macOS 11 was synced with LLVM 11). Fixes #82107