aboutsummaryrefslogtreecommitdiff
path: root/libcxx
AgeCommit message (Collapse)AuthorFilesLines
2021-02-23[libc++] Fix extern-templates.sh.cpp test on Linuxllvmorg-12.0.0-rc2Louis Dionne1-1/+1
(cherry picked from commit bf5941afcda3ac6570ba25165758869287491e0d)
2021-02-23[libc++] Fix extern template test failing on WindowsLouis Dionne1-1/+1
See https://reviews.llvm.org/D94718#2521489 for details. (cherry picked from commit 90407b16b1d3e38f1360b6a24ceab801ab9cefc1)
2021-02-15Define new/delete in libc++ when using libcxxrtDimitry Andric2-0/+11
Always turn on LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS, if libcxxrt is used as the C++ ABI library, since libcxxrt does not provide the full set ofnew and delete operators. In particular, the aligned versions of these operators are completely missing. This primarily addresses builds on FreeBSD, as this platform uses libcxxrt by default. Also, attempt to provide a FreeBSD.cmake cache file, with hopefully sane settings, partially copied from the Apple.cmake cache file. This needs more work, probably some additions to ci build scripts (although I am not aware of any 'official' FreeBSD build bots). Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D96720 (cherry picked from commit 328261019f50a76b11fa625739cbf32ceb2ce2f7)
2021-02-08[🍒][libc++] Fix libcxx build on 32bit architectures with 64bit time_t ↵Louis Dionne1-0/+6
defaults e.g. riscv32 Patch by Khem Raj. (cherry pick of commit 85b9c5ccc172a1e61c7ecaaec4752587cb6f1e26) Differential Revision: https://reviews.llvm.org/D96062
2021-02-08[🍒]Disable CFI in __get_elem to allow casting a pointer to uninitialized ↵Reid Kleckner1-1/+1
memory Fixes usage of shared_ptr with CFI enabled, which is llvm.org/pr48993. (cherry pick of commit bab74864168bb5e28ecbc0294fe1095d8da7f569) Differential Revision: https://reviews.llvm.org/D96063
2021-02-08[🍒][libc++] Rename include/support to include/__supportLouis Dionne30-65/+66
We do ship those headers, so the directory name should not be something that can potentially conflict with user-defined directories. This is a cherry-pick of b51756819a85563ae063e98eeb3d6af8e44c8f64. Differential Revision: https://reviews.llvm.org/D96059
2021-01-27Drop the 'git' suffix from various version variablesTom Stellard1-1/+1
2021-01-26[libc++] Give `MoveOnly` all six comparison operators, not just == and <.Arthur O'Dwyer1-0/+4
Split out of D93512.
2021-01-26[libc++] Fix oss-fuzz buildLouis Dionne1-0/+2
2021-01-25[libcxx] random_device, for OpenBSD specify optimal entropy propertiesBrad Smith1-0/+2
Reviewed By: ldionne Differential Revision: https://reviews.llvm.org/D94571
2021-01-25[libc++] Support immovable return types in std::function.Arthur O'Dwyer4-6/+159
LWG reflector consensus is that this was a bug in libc++. (In particular, MSVC also will fix it in their STL, soon.) Bug originally discovered by Logan Smith. Also fix `std::function<const void()>`, which should work the same way as `std::function<void()>` in terms of allowing "conversions" from non-void types. Differential Revision: https://reviews.llvm.org/D94452
2021-01-25libcxx: Try to fix build after D92044Nico Weber1-1/+1
2021-01-25[libc++] Fix build after 51faba35fd81fbd3af407a29c136895a718ccd96Ruslan Arutyunyan1-6/+4
Differential Revision: https://reviews.llvm.org/D95372
2021-01-25[libc++] [P0879] constexpr std::reverse, partition, *_permutation.Arthur O'Dwyer7-41/+85
After this patch, the only parts of P0879 that remain missing will be std::nth_element, std::sort, and the heap/partial_sort algorithms. Differential Revision: https://reviews.llvm.org/D93443
2021-01-25[libc++] Implement [P0769] "Add shift to algorithm" (shift_left, shift_right)Arthur O'Dwyer9-48/+393
I believe this is a complete implementation of std::shift_left and std::shift_right from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0769r2.pdf Some test cases copied-with-modification from D60027. Differential Revision: https://reviews.llvm.org/D93819
2021-01-25[libc++][doc] Update the release notes.Mark de Wever2-2/+25
Updates the libc++ release notes with the changes since the last release. Differential Revision: https://reviews.llvm.org/D95248
2021-01-25[libc++] Implement P0655R1 visit<R>: Explicit Return Type for visitRuslan Arutyunyan6-81/+583
Differential Revision: https://reviews.llvm.org/D92044
2021-01-25[libc++] Set CMAKE_FOLDER. NFC.Marek Kurdej2-0/+4
* This variable populates the default value of FOLDER target property. It is used in some IDE's (e.g. MSVC) to group different targets together.
2021-01-24[SystemZ][ZOS] Provide PATH_MAX macro for libcxxZbigniew Sarbinowski1-1/+5
Defining PATH_MAX to _XOPEN_PATH_MAX which is the closest macro available on z/OS. Note that this value is 1024 which is 4 times smaller from same macro on Linux. Reviewed By: #libc, ldionne, hubert.reinterpretcast Differential Revision: https://reviews.llvm.org/D92110
2021-01-23[libc++] Remove invalid C++20 code from a test.Mark de Wever1-8/+0
During the review of D91986 it has been discovered the in C++11 deprecated `throw()` exception specification has been removed in C++20. Removed the part of the test code using this feature.
2021-01-23[libc++] Implements concept destructibleMark de Wever3-2/+94
Implements parts of: - P0898R3 Standard Library Concepts - P1754 Rename concepts to standard_case for C++20, while we still can Reviewed By: ldionne, miscco, #libc Differential Revision: https://reviews.llvm.org/D91004
2021-01-22[libc++] Introduce __bitsThorsten Schütt5-117/+150
It has the low-level bit fiddling operations from bit. It eliminates a cyclic dependency between __bit_reference, bits, and vector. I want to exploit this in later patches. Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D94908
2021-01-22[libc++] Bring back mach_absolute_time implementation of steady_clockLouis Dionne1-0/+59
This is meant to unblock Chrome, as discussed in https://llvm.org/D74489. Differential Revision: https://reviews.llvm.org/D95177
2021-01-22[NFC][libc++] Update the implementation status.Mark de Wever1-1/+1
During the review of https://reviews.llvm.org/D93912 we failed to notice the implementation status wasn't updated. This rectifies the issue.
2021-01-22[libc++] Fix broken build when merging libc++abi into libc++ on AppleLouis Dionne1-1/+4
2021-01-21[libcxx] Check return value for asprintf()Brad Smith1-10/+10
local __libcpp_asprintf_l() -> libc asprintf() was inspecting the pointer (with indeterminate value) for failure, rather than the return value of -1. Reviewed By: ldionne Differential Revision: https://reviews.llvm.org/D94564
2021-01-21[libc++] Use ioctl when available to get random_device entropy.Marek Kurdej2-5/+25
Implemented the idea from D94571 to improve entropy on Linux. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D94953
2021-01-20[libc++] Split re.alg tests into locale-dependent and independent testsAlex Richardson17-720/+897
Currently all these tests are XFAILED on Linux even though the problem only seems to be with the few checks that look at collation. To retain test coverage this splits the locale-dependent tests into a separate .pass.cpp that is XFAILed as before. This commit also XFAILs the locale-dependent tests on FreeBSD since the [=M=] and [.ch.] behaviour for cs_CZ also doesn't seem to match the behaviour that is expected by these tests. Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D94969
2021-01-19[libc++][P1679] add string containsWim Leflere14-36/+463
C++23 string contains implementation and tests Paper: https://wg21.link/P1679R3 Standard (string): https://eel.is/c++draft/string.contains Standard (string_view): https://eel.is/c++draft/string.view.ops#lib:contains,basic_string_view Differential Revision: https://reviews.llvm.org/D93912
2021-01-19[libc++] Make LIBCXX_ENABLE_FILESYSTEM fully consistentLouis Dionne36-41/+155
Previously, LIBCXX_ENABLE_FILESYSTEM controlled only whether the filesystem support was compiled into libc++'s library. This commit promotes the setting to a first-class option like LIBCXX_ENABLE_LOCALIZATION, where the whole library is aware of the setting and features that depend on <filesystem> won't be provided at all. The test suite is also properly annotated such that tests that depend on <filesystem> are disabled when the library doesn't support it. This is an alternative to https://llvm.org/D94824, but also an improvement along the lines of LIBCXX_ENABLE_LOCALIZATION that I had been wanting to make for a while. Differential Revision: https://reviews.llvm.org/D94921
2021-01-19[libc++] Unbreak the debug modeLouis Dionne4-47/+104
When the Debug mode is enabled, we disable extern declarations because we don't want to use the functions compiled in the library, which might not have had the debug mode enabled when built. However, some extern declarations need to be kept, because code correctness depends on it. 31e820378b8a removed those declarations, which had the unintended consequence of breaking the debug build. This commit fixes that by re-introducing a separate macro for the required extern declarations, and adds a comment so that we don't fall into that trap in the future. Differential Revision: https://reviews.llvm.org/D94718
2021-01-19[CMake] Remove dead code setting policies to NEWRaul Tambre2-24/+3
cmake_minimum_required(VERSION) calls cmake_policy(VERSION), which sets all policies up to VERSION to NEW. LLVM started requiring CMake 3.13 last year, so we can remove a bunch of code setting policies prior to 3.13 to NEW as it no longer has any effect. Reviewed By: phosek, #libunwind, #libc, #libc_abi, ldionne Differential Revision: https://reviews.llvm.org/D94374
2021-01-19[libc++] Sync TEST_HAS_TIMESPEC_GET and _LIBCPP_HAS_TIMESPEC_GET on FreeBSDAlex Richardson1-2/+4
Commit 5e416ba943b7c737deb8eca62756f7b4fa925845 (D71522) updated the __config header but didn't change test_macros.h. This fixes libcxx/language.support/has_timespec_get.compile.pass.cpp on FreeBSD12/13. Reviewed By: #libc, dim, ldionne Differential Revision: https://reviews.llvm.org/D94292
2021-01-19[libc++] [P0935] [C++20] Eradicating unnecessarily explicit default ↵Marek Kurdej49-268/+1194
constructors from the standard library. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0935r0.html Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D91292
2021-01-18Regenerate the feature test macro unit-tests. NFCI.Arthur O'Dwyer2-10/+10
Somehow commit 1f1250151f222ba391d05dcc173f4b6c65d05ca2 added the right code but with the wrong whitespace.
2021-01-18[libc++] NFCI: Refactor allocator_traitsLouis Dionne2-455/+267
The implementation had a lot of boilerplate and was more complicated than necessary. This NFC refactoring introduces a few macros to reduce code duplication, and uses a consistent style and formatting for the whole file. Differential Revision: https://reviews.llvm.org/D94544
2021-01-18[libc++] improve feature test macro scriptWim Leflere1-47/+52
I've been playing a bit with the `generate_feature_test_macro_components.py` script and replaced some hardcoded values with extra code generation (generate ALL the things). The output is the same and it makes updating the script less work for the coming 25 C++ standards (until 2 digit number overflow). Feel free to 'veto' if you think it's overkill. Differential Revision: https://reviews.llvm.org/D94530
2021-01-18[libc++] Rename check-cxx-deps to cxx-test-depends for consistencyLouis Dionne2-5/+5
Several subprojects have targets that do the same thing, and they all follow the same naming convention: llvm-test-depends, clang-test-depends, lld-test-depends, etc. This makes libc++ consistent with other LLVM projects. Thanks to Duncan Exon Smith for noticing and suggesting the change. Differential Revision: https://reviews.llvm.org/D94499
2021-01-15Fix libc++ clang-cl build, swap attribute orderReid Kleckner2-6/+6
Clang insists that __attribute__ attributes precede __declspec attributes. This is a longstanding known issue: https://llvm.org/pr24559. Re-order the visibility and deprecation macros to fix the build. Differential Revision: https://reviews.llvm.org/D94788
2021-01-15[libcxx testing] Fix UB in tests for std::lock_guardIgor Kudrin2-2/+14
If mutex::try_lock() is called in a thread that already owns the mutex, the behavior is undefined. The patch fixes the issue by creating another thread, where the call is allowed. Differential Revision: https://reviews.llvm.org/D94656
2021-01-12[libc++] Give extern templates default visibility on gccShoaib Meenai2-7/+1
Contrary to the current visibility macro documentation, it appears that gcc does handle visibility attribute on extern templates correctly, e.g. https://godbolt.org/g/EejuV7. We need this so that extern template instantiations of classes not marked _LIBCPP_TEMPLATE_VIS (e.g. __vector_base_common) are correctly exported with gcc when building with hidden visibility. Reviewed By: ldionne Differential Revision: https://reviews.llvm.org/D35388
2021-01-12[libcxx] Avoid overflows in the windows __libcpp_steady_clock_now()Martin Storsjö2-1/+6
As freq.QuadValue can be in the range of 10000000 to 19200000, the multiplication before division makes the calculation overflow and wrap to negative values every 16-30 minutes. Instead count the whole seconds separately before adding the scaled fractional seconds. Add a testcase for steady_clock to check that the values returned for now() compare as bigger than the zero time origin; this corresponds to a testcase in Qt [1] [2] (that failed spuriously due to this). [1] https://bugreports.qt.io/browse/QTBUG-89539 [2] https://code.qt.io/cgit/qt/qtbase.git/tree/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp?id=f8de5e54022b8b7471131b7ad55c83b69b2684c0#n569 Differential Revision: https://reviews.llvm.org/D93456
2021-01-12[libcxx] Port to OpenBSDBrad Smith4-5/+32
Add initial OpenBSD support. Reviewed By: ldionne Differential Revision: https://reviews.llvm.org/D94205
2021-01-12[libc++] Add a missing `<_Compare>` template argument.Arthur O'Dwyer1-3/+4
Sometimes `_Compare` is an lvalue reference type, so letting it be deduced is pretty much always wrong. (Well, less efficient than it could be, anyway.) Differential Revision: https://reviews.llvm.org/D93562
2021-01-12[libc++] [C++2b] [P1048] Add is_scoped_enum and is_scoped_enum_v.Marek Kurdej8-26/+155
* https://wg21.link/p1048 Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D94409
2021-01-11[libc++] Turn off auto-formatting of generated files. NFC.Marek Kurdej51-0/+102
This adds `// clang-format off` in the auto-generated file to avoid lint warnings. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D94410
2021-01-08[libc++] NFC: Document the Differential queries to avoid duplicating workLouis Dionne1-0/+10
Differential Revision: https://reviews.llvm.org/D94343
2021-01-08[libc++] Mark [P0809] "LWG2831: Comparing Unordered Containers" as Nothing ↵Arthur O'Dwyer1-1/+1
To Do. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0809r0.pdf This issue/paper simply removed some library UB because vendors were already doing the right thing. libc++ has always done the right thing (in this respect). Differential Revision: https://reviews.llvm.org/D93816
2021-01-08[libc++] Mark [P0475] "LWG2511: guaranteed copy elision for piecewise ↵Arthur O'Dwyer1-1/+1
construction" as Complete. The point of LWG2511 is basically just to make sure that we use `tuple<Args&&...>` instead of `tuple<Args...>` in a couple of places inside `scoped_allocator_adaptor` and inside `pair`. As far as I can tell, this has been true for libc++ since EricWF's D27612 (and maybe even earlier than that).
2021-01-08Re-enable __cpp_lib_constexpr_functional.Arthur O'Dwyer5-47/+22
I accidentally disabled this feature-test macro in my D93830, due to a rebasing conflict. It had been enabled by my D93815, and should have remained enabled.