aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/any
AgeCommit message (Collapse)AuthorFilesLines
2023-12-18[libc++] Format the code base (#74334)Louis Dionne1-452/+336
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-09[NFC][libc++] Rewrites a return statement.Mark de Wever1-3/+1
This fixes a clang-tidy diagnostic when building libc++ with RTTI disabled. This was originally part of #65518.
2023-12-05[libc++] Replace uses of _VSTD:: by std:: (#74331)Louis Dionne1-18/+18
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 Dionne1-50/+50
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-31[libc++] Remove alignment_of uses (#70591)philnik7771-4/+2
There is no reason to use `alignment_of<T>` instead of `alignof(T)` or `_LIBCPP_ALIGNOF(T)`. It only makes the code more verbose and results in slightly worse compile times.
2023-07-06Fixing conflicting macro definitions between curses.h and the standard library.Nicole Rabjohn1-0/+5
POSIX allows certain macros to exist with generic names (i.e. refresh(), move(), and erase()) to exist in `curses.h` which conflict with functions found in std::filesystem, among others. This patch undefs the macros in question and adds them to LIBCPP_PUSH_MACROS and LIBCPP_POP_MACROS. Reviewed By: #libc, philnik, ldionne Differential Revision: https://reviews.llvm.org/D147356
2023-06-15[libc++] Merge _LIBCPP_FUNC_VIS, _LIBCPP_TYPE_VIS and _LIBCPP_EXCEPTION_ABI ↵Nikolas Klauser1-1/+1
into _LIBCPP_EXPORTED_FROM_ABI These macros are always defined identically, so we can simplify the code a bit by merging them. Reviewed By: ldionne, #libc Spies: libcxx-commits, krytarowski, smeenai Differential Revision: https://reviews.llvm.org/D152652
2023-05-03[libc++][PSTL] Reduce the amount of transitive includesNikolas Klauser1-0/+1
Reviewed By: ldionne, #libc Spies: libcxx-commits, miyuki Differential Revision: https://reviews.llvm.org/D149599
2023-04-16[libc++] Add hide_from_abi check for classesNikolas Klauser1-1/+1
We already have a clang-tidy check for making sure that `_LIBCPP_HIDE_FROM_ABI` is on free functions. This patch extends this to class members. The places where we don't check for `_LIBCPP_HIDE_FROM_ABI` are classes for which we have an instantiation in the library. Reviewed By: ldionne, Mordante, #libc Spies: jplehr, mikhail.ramalho, sstefan1, libcxx-commits, krytarowski, miyuki, smeenai Differential Revision: https://reviews.llvm.org/D142332
2023-04-09[libc++] Remove <cstdlib> includesNikolas Klauser1-1/+1
We changed the `abort` calls when trying to throw exceptions in `-fno-exceptions` mode to `__verbose_abort` calls, which removes the dependency in most files. Reviewed By: ldionne, #libc Spies: dim, emaste, mikhail.ramalho, smeenai, libcxx-commits Differential Revision: https://reviews.llvm.org/D146076
2023-03-18[libc++] Use the _LIBCPP_VERBOSE_ABORT macro instead of calling the function ↵Nikolas Klauser1-1/+1
directly These calls were added in D141222. Reviewed By: #libc, ldionne Spies: ldionne, libcxx-commits, smeenai, mikhail.ramalho Differential Revision: https://reviews.llvm.org/D146227
2023-03-14[libc++] Use __verbose_abort instead of std::abort in __throw_ functionsNikolas Klauser1-1/+2
This results in proper error messages instead of just an abort. Reviewed By: ldionne, Mordante, #libc Spies: #libc_vendors, smeenai, libcxx-commits Differential Revision: https://reviews.llvm.org/D141222
2023-03-12[libc++] Granularize <exception>Nikolas Klauser1-0/+2
This patch also updates the moved code to the new style (i.e. formatted, replaced marcos and typedefs) Reviewed By: ldionne, #libc Spies: arichardson, libcxx-commits Differential Revision: https://reviews.llvm.org/D145095
2023-03-08[libc++] Granularize <type_traits> includesNikolas Klauser1-1/+14
Reviewed By: ldionne, #libc, #libc_abi Spies: #libc_vendors, smeenai, libcxx-commits Differential Revision: https://reviews.llvm.org/D145320
2023-02-17[libc++][NFC] Rename _LIBCPP_NO_EXCEPTIONS to _LIBCPP_HAS_NO_EXCEPTIONSNikolas Klauser1-1/+1
Other macros that disable parts of the library are named `_LIBCPP_HAS_NO_WHATEVER`. Reviewed By: ldionne, Mordante, #libc Spies: libcxx-commits, smeenai Differential Revision: https://reviews.llvm.org/D143163
2023-02-15[libc++][NFC] Replace _LIBCPP_STD_VER > x with _LIBCPP_STD_VER >= xNikolas Klauser1-2/+2
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-02-05[libc++][NFC] Rename _LIBCPP_NO_RTTI to _LIBCPP_HAS_NO_RTTINikolas Klauser1-5/+5
Other macros that disable parts of the library are named `_LIBCPP_HAS_NO_WHATEVER`. Reviewed By: ldionne, Mordante, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D143164
2023-01-21[libc++] Implement P1413R3 (Deprecate std::aligned_storage and ↵Nikolas Klauser1-0/+2
std::aligned_union) There are no tests for the aliases because clang doesn't diagnose deprecated template aliases currently. Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D127678
2022-11-05[libc++] Split __allocator_destructor out of shared_ptr.hNikolas Klauser1-1/+3
Reviewed By: ldionne, huixie90, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D134479
2022-11-05[libc++] Granularize <concept> includesNikolas Klauser1-0/+1
Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D137283
2022-09-25[libc++] Rewrites graph_header_deps.py.Mark de Wever1-1/+1
The new version is a lot simpler and has less option which were not used. This uses the CSV files as generated by D133127 as input data. The current Python script has more features but uses a simple "grep" making the output less accurate: - Conditionally included header are always included. This is an issue since part of our includes are unneeded transitive includes. Based on the language version they may be omitted. The script however always includes them. - Includes in comments are processed as-if they are includes. This is an issue when comments explain how certain data is generated; of course there are digraphs which the script omits. This implementation uses Clang's --trace-includes to generate the includes per header. This means the input of the generation script always has the real list of includes. Libc++ is moving from large monolithic Standard headers to more fine grained headers. For example, algorithm includes every header in `__algorithm`. Adding all these detail headers in the graph makes the output unusable. Instead it only shows the Standard headers. The transitive includes of the detail headers are parsed and "attributed" to the Standard header including them. This gives an accurate include graph without the unneeded clutter. Note that this graph is still big. This changes fixes the cyclic dependency issue with the previous version of the tool so the markers and its documentation is removed. Since the input has no cycles the CI test is removed. Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D134188
2022-09-06[libc++] Avoid instantiating type_trait classesNikolas Klauser1-4/+4
Use `using` aliases to avoid instantiating lots of types Reviewed By: ldionne, #libc Spies: libcxx-commits, miyuki Differential Revision: https://reviews.llvm.org/D132785
2022-09-05[libc++] Granularize the rest of memoryNikolas Klauser1-1/+10
Reviewed By: ldionne, #libc Spies: vitalybuka, paulkirth, libcxx-commits, mgorny Differential Revision: https://reviews.llvm.org/D132790
2022-09-03[NFC][libc++] Moves transitive includes location.Mark de Wever1-4/+4
As discussed in D132284 they will be moved to the end. Reviewed By: #libc, Mordante Differential Revision: https://reviews.llvm.org/D133212
2022-09-02Revert "[libc++] Granularize the rest of memory"Vitaly Buka1-11/+1
Breaks buildbots. This reverts commit 30adaa730c4768b5eb06719c808b2884fcf53cf3.
2022-09-02[libc++] Granularize the rest of memoryNikolas Klauser1-1/+11
Reviewed By: ldionne, #libc Spies: libcxx-commits, mgorny Differential Revision: https://reviews.llvm.org/D132790
2022-09-02[libc++] Make the naming of private member variables consistent and enforce ↵Nikolas Klauser1-33/+33
it through readability-identifier-naming Reviewed By: ldionne, #libc Spies: aheejin, sstefan1, libcxx-commits Differential Revision: https://reviews.llvm.org/D129386
2022-08-31[libc++] Reduces the number of transitive includes.Mark de Wever1-2/+2
This defines a new policy for removal of transitive includes. The goal of the policy it to make it relatively easy to remove headers when needed, but avoid breaking developers using and vendors shipping libc++. The method used is to guard transitive includes based on the C++ language version. For the upcoming C++23 we can remove headers when we want, but for other language versions we try to keep it to a minimum. In this code the transitive include of `<chrono>` is removed since D128577 introduces a header cycle between `<format>` and `<chrono>`. This cycle is indirectly required by the Standard. Our cycle dependency tool basically is a grep based tool, so it needs some hints to ignore cycles. With the input of our transitive include tests we can create a better tool. However that's out of the scope of this patch. Note the flag `_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` remains unchanged. So users can still opt-out of transitives includes entirely. Reviewed By: #libc, ldionne, philnik Differential Revision: https://reviews.llvm.org/D132284
2022-08-25[libc++][NFC] Enable modernize-use-overrideNikolas Klauser1-1/+1
Reviewed By: Mordante, #libc Spies: aheejin, libcxx-commits, smeenai Differential Revision: https://reviews.llvm.org/D124714
2022-07-08[libc++] Make parameter names consistent and enforce the naming style using ↵Nikolas Klauser1-1/+1
readability-identifier-naming Ensure that parameter names have the style `__lower_case` Reviewed By: ldionne, #libc Spies: aheejin, sstefan1, libcxx-commits, miyuki Differential Revision: https://reviews.llvm.org/D129051
2022-06-27[libc++] Re-add transitive includes that had been removed since LLVM 14Louis Dionne1-0/+4
This commit re-adds transitive includes that had been removed by 4cd04d1687f1, c36870c8e79c, a83f4b9cda57, 1458458b558d, 2e2f3158c604, and 489637e66dd3. This should cover almost all the includes that had been removed since LLVM 14 and that would contribute to breaking user code when releasing LLVM 15. It is possible to disable the inclusion of these headers by defining _LIBCPP_REMOVE_TRANSITIVE_INCLUDES. The intent is that vendors will enable that macro and start fixing downstream issues immediately. We can then remove the macro (and the transitive includes) by default in a future release. That way, we will break users only once by removing transitive includes in bulk instead of doing it bit by bit a every release, which is more disruptive for users. Note 1: The set of headers to re-add was found by re-generating the transitive include test on a checkout of release/14.x, which provided the list of all transitive includes we used to provide. Note 2: Several includes of <vector>, <optional>, <array> and <unordered_map> have been added in this commit. These transitive inclusions were added when we implemented boyer_moore_searcher in <functional>. Note 3: This is a best effort patch to try and resolve downstream breakage caused since branching LLVM 14. I wasn't able to perfectly mirror transitive includes in LLVM 14 for a few headers, so I added a release note explaining it. To summarize, adding boyer_moore_searcher created a bunch of circular dependencies, so we have to break backwards compatibility in a few cases. Differential Revision: https://reviews.llvm.org/D128661
2022-06-10[libc++] Granularize <iterator> includesNikolas Klauser1-0/+1
Reviewed By: ldionne, #libc Spies: libcxx-commits, wenlei Differential Revision: https://reviews.llvm.org/D127445
2022-05-27[libc++] Add various missing _LIBCPP_HIDE_FROM_ABILouis Dionne1-0/+1
Those were spotted when a project unintentionally started exporting these symbols from its ABI just by using the libc++ headers. Differential Revision: https://reviews.llvm.org/D126496
2022-03-30[libc++] Ensure that all public C++ headers include <__assert>Louis Dionne1-0/+1
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-03-15[libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable ↵Louis Dionne1-0/+3
warnings in the test suite This should make CI consistent on all the compilers we support. Most of this patch is working around various warnings emitted by GCC in our code base, which are now being shown when we compile the tests. After this patch, the whole test suite should be warning free on all compilers we support and test, except for a few warnings on GCC that we silence explicitly until we figure out the proper fix for them. Differential Revision: https://reviews.llvm.org/D120684
2022-03-05[libc++] Granularize <utility> includesNikolas Klauser1-0/+2
Reviewed By: ldionne, #libc Spies: EricWF, libcxx-commits, arphaman Differential Revision: https://reviews.llvm.org/D120466
2022-02-04[libc++] Normalize all our '#pragma GCC system_header', and regression-test.Arthur O'Dwyer1-1/+1
Now we'll notice if a header forgets to include this magic phrase. Differential Revision: https://reviews.llvm.org/D118800
2021-11-17[runtimes][NFC] Remove filenames at the top of the license noticeLouis Dionne1-1/+1
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-06-24[libcxx][modularisation] moves <utility> content out of <type_traits>Christopher Di Bella1-0/+1
Moves: * `std::move`, `std::forward`, `std::declval`, and `std::swap` into `__utility/${FUNCTION_NAME}`. * `std::swap_ranges` and `std::iter_swap` into `__algorithm/${FUNCTION_NAME}` Differential Revision: https://reviews.llvm.org/D103734
2021-05-29[libc++] Alphabetize and include-what-you-use. NFCI.Arthur O'Dwyer1-3/+3
Differential Revision: https://reviews.llvm.org/D102781
2021-03-22[libc++] Include <__config> first in all standard headers.Arthur O'Dwyer1-1/+1
Mostly, *don't* include <experimental/__config> from C++17 <any>, because that doesn't make any sense. I think it was just a cut-and-paste typo when this header moved from experimental/. Differential Revision: https://reviews.llvm.org/D99089
2020-11-05[libc++] Rework the whole availability markup implementationLouis Dionne1-0/+1
Currently, vendor-specific availability markup is enabled by default. This means that even when building against trunk libc++, the headers will by default prevent you from using some features that were not released in the dylib on your target platform. This is a source of frustration since people building libc++ from sources are usually not trying to use some vendor's released dylib. For that reason, I've been thinking for a long time that availability annotations should be off by default, which is the primary change that this commit enables. In addition, it reworks the implementation to make it easier for new vendors to add availability annotations for their platform, and it refreshes the documentation to reflect the current state of the codebase. Finally, a CMake configuration option is added to control whether availability annotations should be turned on for the flavor of libc++ being created. The intent is for vendors like Apple to turn it on, and for the upstream libc++ to leave it off (the default). Differential Revision: https://reviews.llvm.org/D90843
2020-09-21[libc++] Fix failures when running the test suite without RTTILouis Dionne1-1/+1
2020-09-15[libc++] Use allocator_traits to consistently ↵Marshall Clow1-7/+20
allocate/deallocate/construct/destroy objects in std::any https://llvm.org/PR45099 notes (correctly) that we're inconsistent in memory allocation in `std::any`. We allocate memory with `std::allocator<T>::allocate`, construct with placement new, destroy by calling the destructor directly, and deallocate by calling `delete`. Most of those are customizable by the user, but in different ways. The standard is silent on how these things are to be accomplished. This patch makes it so we use `allocator_traits<allocator<T>>` for all of these operations (allocate, construct, destruct, deallocate). This is, at least, consistent. Fixes https://llvm.org/PR45099. Differential Revision: https://reviews.llvm.org/D81133
2019-06-19[NFC][libc++] Remove stray semi-colon after function definitionLouis Dionne1-1/+1
llvm-svn: 363835
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-4/+3
to reflect the new license. 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: 351636
2018-11-19[libcxx] Add availability markup for bad_optional_access, bad_variant_access ↵Louis Dionne1-1/+5
and bad_any_cast Reviewers: dexonsmith, EricWF Subscribers: christof, arphaman, libcxx-commits Differential Revision: https://reviews.llvm.org/D53256 llvm-svn: 347219
2018-09-12Implement the infrastructure for feature-test macros. Very few actual ↵Marshall Clow1-0/+1
feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 llvm-svn: 342073
2018-08-03[NFC][libc++] Consistently use spaces to indentLouis Dionne1-1/+1
rdar://problem/19988944 llvm-svn: 338933
2018-07-11[libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by ↵Louis Dionne1-3/+3
_LIBCPP_INLINE_VISIBILITY Summary: We never actually mean to always inline a function -- all the uses of the macro I could find are actually attempts to control the visibility of symbols. This is better described by _LIBCPP_INLINE_VISIBILITY, which is actually always defined the same. This change is orthogonal to the decision of what we're actually going to do with _LIBCPP_INLINE_VISIBILITY -- it just simplifies things by having one canonical way of doing things. Note that this commit had originally been applied in r336369 and then reverted in r336382 because of unforeseen problems. Both of these problems have now been fixed. Reviewers: EricWF, mclow.lists Subscribers: christof, dexonsmith, erikvanderpoel Differential Revision: https://reviews.llvm.org/D48892 llvm-svn: 336866