summaryrefslogtreecommitdiff
path: root/libcxx/include/complex
AgeCommit message (Collapse)Author
2025-06-24[libc++] Fix no-localisation CI failure on <complex> (#145213)Hui
2025-05-08[libc++] Simplify __promote (#136101)Nikolas Klauser
This avoids instantiating an extra class for every variant `__promote` is used in.
2025-04-09[libc++] Remove _LIBCPP_TEMPLATE_VIS (#134885)Nikolas Klauser
The need for `_LIBCPP_TEMPLATE_VIS` has been removed in #133233.
2025-03-23[libc++] Add [[gnu::nodebug]] on type traits (#128502)Nikolas Klauser
2025-01-08[libc++] Put _LIBCPP_NODEBUG on all internal aliases (#118710)Nikolas Klauser
This significantly reduces the amount of debug information generated for codebases using libc++, without hurting the debugging experience.
2024-12-21[libc++][C++03] Use `__cxx03/` headers in C++03 mode (#109002)Nikolas Klauser
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-10[libc++] Add #if 0 block to all the top-level headers (#119234)Nikolas Klauser
Including The frozen C++03 headers results in a lot of formatting changes in the main headers, so this splits these changes into a separate commit instead. This is part of https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.
2024-11-06[libc++] Refactor the configuration macros to being always defined (#112094)Nikolas Klauser
This is a follow-up to #89178. This updates the `<__config_site>` macros.
2024-10-30[libc++] Constrain additional overloads of `pow` for `complex` harder (#110235)A. Jiang
Fixes #109858. The changes in #81379 broke some 3rd party library code that expected usability of `std::complex<NonFloatingPoint>`. Although such code isn't portable per [complex.numbers.general]/2, it might be better to make these additional overloads not to interfere overload resolution too much. --------- Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2024-09-08[libc++][NFC] Use std::isinf in non-constexpr functions (#107690)Nikolas Klauser
2024-08-29[libc++][NFC] Remove __constexpr_is{nan,finite} (#106205)Nikolas Klauser
They're never used in `constexpr` functions, so we can simply use `std::isnan` and `std::isfinite` instead.
2024-08-14[libc++] Fix ambiguous constructors for std::complex and std::optional (#103409)Louis Dionne
Fixes #101960
2024-07-05[libc++] Adds a missing include.Mark de Wever
This should fix the clang modules with the locales disabled build in the CI.
2024-07-05[libc++] Use _Complex for multiplication and division of complex floating ↵Nikolas Klauser
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-03-16[libc++][NFC] Use the tuple forward declaration header for tuple forward ↵Nikolas Klauser
declarations
2024-02-29[libc++] Clean up includes of <__assert> (#80091)Louis Dionne
Originally, we used __libcpp_verbose_abort to handle assertion failures. That function was declared from all public headers. Since we don't use that mechanism anymore, we don't need to declare __libcpp_verbose_abort from all public headers, and we can clean up a lot of unnecessary includes. This patch also moves the definition of the various assertion categories to the <__assert> header, since we now rely on regular IWYU for these assertion macros. rdar://105510916
2024-02-19[libc++][complex] P2819R2: Add `tuple` protocol to `complex` (#79744)Hristo Hristov
Implements: P2819R2 <https://wg21.link/P2819R2> - https://eel.is/c++draft/utilities#concept:tuple-like - https://eel.is/c++draft/complex.syn - https://eel.is/c++draft/complex.tuple --------- Co-authored-by: Zingam <zingam@outlook.com>
2023-12-18[libc++] Format the code base (#74334)Louis Dionne
This patch runs clang-format on all of libcxx/include and libcxx/src, in accordance with the RFC discussed at [1]. Follow-up patches will format the benchmarks, the test suite and remaining parts of the code. I'm splitting this one into its own patch so the diff is a bit easier to review. This patch was generated with: find libcxx/include libcxx/src -type f \ | grep -v 'module.modulemap.in' \ | grep -v 'CMakeLists.txt' \ | grep -v 'README.txt' \ | grep -v 'libcxx.imp' \ | grep -v '__config_site.in' \ | xargs clang-format -i A Git merge driver is available in libcxx/utils/clang-format-merge-driver.sh to help resolve merge and rebase issues across these formatting changes. [1]: https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all
2023-12-13[libc++][NFC] Add a few explicit 'inline' keywords, mostly in <chrono> (#75234)Louis Dionne
Even though constexpr implicitly makes functions inline, we try not to rely on this implicit effect in the code base. We are mostly consistent about using `inline` on non-template free-functions to make it clear that we don't have an ODR violation. This patch simply fixes a few places where we didn't explicitly use inline on non-template free functions, presumably because they were constexpr. Fixes #75227
2023-12-05[libc++] Replace uses of _VSTD:: by std:: (#74331)Louis Dionne
As part of the upcoming clang-formatting of libc++, this patch performs the long desired removal of the _VSTD macro. See https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all for the clang-format proposal.
2023-12-04[libc++] Rename _LIBCPP_INLINE_VISIBILITY to _LIBCPP_HIDE_FROM_ABI (#74095)Louis Dionne
In preparation for running clang-format on the whole code base, we are also removing mentions of the legacy _LIBCPP_INLINE_VISIBILITY macro in favor of the newer _LIBCPP_HIDE_FROM_ABI. We're still leaving the definition of _LIBCPP_INLINE_VISIBILITY to avoid creating needless breakage in case some older patches are checked-in with mentions of the old macro. After we branch for LLVM 18, we can do another pass to clean up remaining uses of the macro that might have gotten introduced by mistake (if any) and remove the macro itself at the same time. This is just a minor convenience to smooth out the transition as much as possible. See https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all for the clang-format proposal.
2023-10-29[libc++] Remove a few transitive includes (#70553)philnik777
2023-08-15[libc++][NFC] Refactor return type enable_ifs to defaulted template argumentsNikolas Klauser
This brings most of the enable_ifs in libc++ to the same style. It also has the nice side-effect of reducing the size of names of these symbols, since the depedent return type is shorter. Reviewed By: #libc, ldionne Spies: ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D157736
2023-06-11[libc++][spaceship] P1614R2: Removed ops from `complex`Hristo Hristov
Implements parts of P1614R2: - Removed ops from `complex` Reviewed By: #libc, Mordante Differential Revision: https://reviews.llvm.org/D152615
2023-03-08[libc++] Granularize <type_traits> includesNikolas Klauser
Reviewed By: ldionne, #libc, #libc_abi Spies: #libc_vendors, smeenai, libcxx-commits Differential Revision: https://reviews.llvm.org/D145320
2023-02-15[libc++][NFC] Replace _LIBCPP_STD_VER > x with _LIBCPP_STD_VER >= xNikolas Klauser
This change is almost fully mechanical. The only interesting change is in `generate_feature_test_macro_components.py` to generate `_LIBCPP_STD_VER >=` instead. To avoid churn in the git-blame this commit should be added to the `.git-blame-ignore-revs` once committed. Reviewed By: ldionne, var-const, #libc Spies: jloser, libcxx-commits, arichardson, arphaman, wenlei Differential Revision: https://reviews.llvm.org/D143962
2023-01-08[libc++] [C++20] [P0415] Constexpr for std::complex.Marek Kurdej
This patch adds constexpr to <complex> header: operators, member operators, and member functions (real, imag, norm, conj). https://eel.is/c++draft/complex.numbers https://wg21.link/p0415 Reviewed By: ldionne, #libc Spies: philnik, danilaml, Quuxplusone, wmaxey, arichardson, libcxx-commits Differential Revision: https://reviews.llvm.org/D79555
2022-12-23[libc++] Add custom clang-tidy checksNikolas Klauser
Reviewed By: #libc, ldionne Spies: jwakely, beanz, smeenai, cfe-commits, tschuett, avogelsgesang, Mordante, sstefan1, libcxx-commits, ldionne, mgorny, arichardson, miyuki Differential Revision: https://reviews.llvm.org/D131963
2022-12-08[libc++][NFC] Rename __libcpp_*_or_builtin to __constexpr_*Nikolas Klauser
We normally use the `__libcpp_` prefix to backport functions, but that doesn't really make sense here. The functions are always available. Using `__constexpr_` makes the intended use of the functions clear. Reviewed By: Mordante, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D139521
2022-08-19[libc++][NFC] Rename the constexpr macrosNikolas Klauser
This was discussed on Discord with the consensus that we should rename the macros. Reviewed By: ldionne, Mordante, var-const, avogelsgesang, jloser, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D131498
2022-08-13[libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABINikolas Klauser
Reviewed By: ldionne, Mordante, var-const, huixie90, #libc Spies: jloser, libcxx-commits, arichardson, miyuki Differential Revision: https://reviews.llvm.org/D129968
2022-03-30[libc++] Ensure that all public C++ headers include <__assert>Louis Dionne
This patch changes the requirement for getting the declaration of the assertion handler from including <__assert> to including any public C++ header of the library. Note that C compatibility headers are excluded because we don't implement all the C headers ourselves -- some of them are taken straight from the C library, like assert.h. It also adds a generated test to check it. Furthermore, this new generated test is designed in a way that will make it possible to replace almost all the existing test-generation scripts with this system in upcoming patches. Differential Revision: https://reviews.llvm.org/D122506
2022-02-04[libc++] Normalize all our '#pragma GCC system_header', and regression-test.Arthur O'Dwyer
Now we'll notice if a header forgets to include this magic phrase. Differential Revision: https://reviews.llvm.org/D118800
2021-12-02[libc++][NFC] Update namespace comments in include/Nikolas Klauser
update the namspace comments in include/ Reviewed By: ldionne, #libc Spies: smeenai, libcxx-commits Differential Revision: https://reviews.llvm.org/D114947
2021-11-17[runtimes][NFC] Remove filenames at the top of the license noticeLouis Dionne
We've stopped doing it in libc++ for a while now because these names would end up rotting as we move things around and copy/paste stuff. This cleans up all the existing files so as to stop the spreading as people copy-paste headers around.
2021-10-28[libc++] Fix buggy numerics of tanh(complex) at infXiang Gao
Because: lim[x->inf, tanh(x+iy)] = 1 lim[x->-inf, tanh(x+iy)] = -1 See also https://github.com/NVIDIA/libcudacxx/pull/210 Differential Revision: https://reviews.llvm.org/D112252
2021-10-28[libc++] Fix numeric of exp(complex) at infXiang Gao
This fixes the bug that exp({501, 0}) returns {inf, nan} instead of {inf, 0}. Differential Revision: https://reviews.llvm.org/D112277
2021-05-29[libc++] Alphabetize and include-what-you-use. NFCI.Arthur O'Dwyer
Differential Revision: https://reviews.llvm.org/D102781
2021-04-20[libc++] NFC: Normalize `#endif //` comment indentationLouis Dionne
2020-12-01[libc++] Consistently replace `std::` qualification with `_VSTD::` or ↵Arthur O'Dwyer
nothing. NFCI. I used a lot of `git grep` to find places where `std::` was being used outside of comments and assert-messages. There were three outcomes: - Qualified function calls, e.g. `std::move` becomes `_VSTD::move`. This is the most common case. - Typenames that don't need qualification, e.g. `std::allocator` becomes `allocator`. Leaving these as `_VSTD::allocator` would also be fine, but I decided that removing the qualification is more consistent with existing practice. - Names that specifically need un-versioned `std::` qualification, or that I wasn't sure about. For example, I didn't touch any code in <atomic>, <math.h>, <new>, or any ext/ or experimental/ headers; and I didn't touch any instances of `std::type_info`. In some deduction guides, we were accidentally using `class Alloc = typename std::allocator<T>`, despite `std::allocator<T>`'s type-ness not being template-dependent. Because `std::allocator` is a qualified name, this did parse as we intended; but what we meant was simply `class Alloc = allocator<T>`. Differential Revision: https://reviews.llvm.org/D92250
2020-10-27[libc++] Add a libc++ configuration that does not support localizationLouis Dionne
When porting libc++ to embedded systems, it can be useful to drop support for localization, which these systems don't implement or care about. Differential Revision: https://reviews.llvm.org/D90072
2020-10-19[libc++] Add more tests for operator<< on std::complexLouis Dionne
2020-05-07[libc++] Fix ostream for complex numbers with fixed field widthAntonio Sanchez
The ostream operator<< is currently broken for std::complex with specified field widths. This patch a partial revert of c3478eff7a65 (reviewed as D71214), restoring the correct behavior. Differential Revision: https://reviews.llvm.org/D78816
2020-02-19[libc++] reduce <complex> parsing timeLouis Dionne
Instead of including <ios> for ios_base::failbit, simply get failbit member of the template argument. Print directly to a stream instead of using intermediate ostringstream. Parsing time: 874ms -> 164ms (-81%) Thanks to Nikita Kniazev for the patch! Differential Revision: https://reviews.llvm.org/D71214
2019-05-29[NFC][libcxx] Remove trailing whitespaceLouis Dionne
It's incredibly annoying when trying to create diffs llvm-svn: 361981
2019-01-19Update more file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
2018-09-12Implement the infrastructure for feature-test macros. Very few actual ↵Marshall Clow
feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 llvm-svn: 342073
2018-02-19[libcxx] Improve accuracy of complex asinh and acoshMikhail Maltsev
Summary: Currently std::asinh and std::acosh use std::pow to compute x^2. This results in a significant error when computing e.g. asinh(i) or acosh(-1). This patch expresses x^2 directly via x.real() and x.imag(), like it is done in libstdc++/glibc, and adds tests that checks the accuracy. Reviewers: EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D41629 llvm-svn: 325510
2018-01-31Implement LWG2870: Default value of parameter theta of polar should be dependentMarshall Clow
llvm-svn: 323918
2017-07-07cmath: Support clang's -fdelayed-template-parsingDuncan P. N. Exon Smith
r283051 added some functions to cmath (in namespace std) that have the same name as functions in math.h (in the global namespace). Clang's limited support for `-fdelayed-template-parsing` chokes on this. Rename the ones in `cmath` and their uses in `complex` and the test. rdar://problem/32848355 llvm-svn: 307357