summaryrefslogtreecommitdiffstats
path: root/libcxx
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "Extension: Mark the default constructor of chrono::duration as ↵Marshall Clow2019-09-232-48/+1
| | | | | | | | conditionally noexcept"; this breaks the gcc5 bot for C++11 This reverts commit c8ca15c95c4c0d6d1356500d5fe49a319ea4ca01. llvm-svn: 372546
* Extension: Mark the default constructor of chrono::duration as conditionally ↵Marshall Clow2019-09-232-1/+48
| | | | | | noexcept llvm-svn: 372539
* Revert "Revert "Implement std::condition_variable via ↵Dan Albert2019-09-183-28/+160
| | | | | | | | | | pthread_cond_clockwait() where available"" With the fix for non-Linux. This reverts commit c1c519d2f1a66dd2eeaa4c321d8d7b50f623eb71. llvm-svn: 372242
* Revert "Implement std::condition_variable via pthread_cond_clockwait() where ↵Dan Albert2019-09-163-156/+28
| | | | | | | | available" This reverts commit 5e37d7f9ff257ec62d733d3d94b11f03e0fe51ca. llvm-svn: 372034
* Open fstream files in O_CLOEXEC mode when possible.Dan Albert2019-09-162-12/+23
| | | | | | | | | | | | | | Reviewers: EricWF, mclow.lists, ldionne Reviewed By: ldionne Subscribers: smeenai, dexonsmith, christof, ldionne, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D59839 llvm-svn: 372027
* Implement std::condition_variable via pthread_cond_clockwait() where availableDan Albert2019-09-163-28/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::condition_variable is currently implemented via pthread_cond_timedwait() on systems that use pthread. This is problematic, since that function waits by default on CLOCK_REALTIME and libc++ does not provide any mechanism to change from this default. Due to this, regardless of if condition_variable::wait_until() is called with a chrono::system_clock or chrono::steady_clock parameter, condition_variable::wait_until() will wait using CLOCK_REALTIME. This is not accurate to the C++ standard as calling condition_variable::wait_until() with a chrono::steady_clock parameter should use CLOCK_MONOTONIC. This is particularly problematic because CLOCK_REALTIME is a bad choice as it is subject to discontinuous time adjustments, that may cause condition_variable::wait_until() to immediately timeout or wait indefinitely. This change fixes this issue with a new POSIX function, pthread_cond_clockwait() proposed on http://austingroupbugs.net/view.php?id=1216. The new function is similar to pthread_cond_timedwait() with the addition of a clock parameter that allows it to wait using either CLOCK_REALTIME or CLOCK_MONOTONIC, thus allowing condition_variable::wait_until() to wait using CLOCK_REALTIME for chrono::system_clock and CLOCK_MONOTONIC for chrono::steady_clock. pthread_cond_clockwait() is implemented in glibc (2.30 and later) and Android's bionic (Android API version 30 and later). This change additionally makes wait_for() and wait_until() with clocks other than chrono::system_clock use CLOCK_MONOTONIC.<Paste> llvm-svn: 372016
* Add debug check for null pointers passed to <string_view>Eric Fiselier2019-09-143-1/+49
| | | | llvm-svn: 371925
* Fix C++03 build failures due to >>Eric Fiselier2019-09-131-1/+1
| | | | llvm-svn: 371894
* Mark [[nodiscard]] test as unsupported with GCC 5Eric Fiselier2019-09-131-0/+1
| | | | llvm-svn: 371886
* Fix pretty printer test with GCCEric Fiselier2019-09-131-3/+14
| | | | llvm-svn: 371884
* Fix various test failures with GCCEric Fiselier2019-09-133-5/+9
| | | | llvm-svn: 371880
* Fix failing negative compilation test for some versions of ClangEric Fiselier2019-09-131-0/+1
| | | | llvm-svn: 371874
* Recommit r370502: Make `vector` unconditionally move elements whenEric Fiselier2019-09-135-55/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | exceptions are disabled. The patch was reverted due to some confusion about non-movable types. ie types that explicitly delete their move constructors. However, such types do not meet the requirement for `MoveConstructible`, which is required by `std::vector`: Summary: `std::vector<T>` is free choose between using copy or move operations when it needs to resize. The standard only candidates that the correct exception safety guarantees are provided. When exceptions are disabled these guarantees are trivially satisfied. Meaning vector is free to optimize it's implementation by moving instead of copying. This patch makes `std::vector` unconditionally move elements when exceptions are disabled. This optimization is conforming according to the current standard wording. There are concerns that moving in `-fno-noexceptions`mode will be a surprise to users. For example, a user may be surprised to find their code is slower with exceptions enabled than it is disabled. I'm sympathetic to this surprised, but I don't think it should block this optimization. Reviewers: mclow.lists, ldionne, rsmith Reviewed By: ldionne Subscribers: zoecarver, christof, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D62228 llvm-svn: 371867
* Only initialize the streams cout/wcout/cerr/wcerr etc once, rather than any ↵Marshall Clow2019-09-132-2/+49
| | | | | | time Init::Init is called. Fixes PR#43300 llvm-svn: 371864
* Fix build in C++20Eric Fiselier2019-09-131-2/+2
| | | | llvm-svn: 371863
* [libc++] Mark issue 2587 resolved by issue 2567Zoe Carver2019-09-121-1/+1
| | | | | | Updates status. NFC. llvm-svn: 371763
* Consolidate swap, swap_ranges, and iter_swap in <type_traits>.Zoe Carver2019-09-112-22/+26
| | | | | | NFC. Thanks to @Quuxplusone (Arthur O'Dwyer) for this change. llvm-svn: 371639
* [libc++] Add a CMake cache for Apple-specific configuration optionsLouis Dionne2019-09-113-6/+25
| | | | llvm-svn: 371638
* Remove ::gets for FreeBSD 13 and laterDimitry Andric2019-09-072-1/+8
| | | | | | | | | | | | | | | | | | Summary: In https://svnweb.freebsd.org/changeset/base/351659 @emaste removed gets() from FreeBSD 13's libc, and our copies of libc++ and libstdc++. In that change, the declarations were simply deleted, but I would like to propose this conditional test instead. Reviewers: EricWF, mclow.lists, emaste Reviewed By: mclow.lists Subscribers: krytarowski, christof, ldionne, emaste, libcxx-commits Differential Revision: https://reviews.llvm.org/D67316 llvm-svn: 371324
* Add gdb pretty printers for a wide variety of libc++ data structures (take 2).Sterling Augustine2019-09-053-0/+1736
| | | | | | | | | | | | | | | | | Summary: This patch is an exact duplicate of https://reviews.llvm.org/D65609, except that it uses the newly introduced testing framework to detect if gdb is present so that the tests won't fail on machines without gdb. Reviewers: echristo, EricWF Subscribers: christof, ldionne, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67238 llvm-svn: 371131
* Don't assume libcxx_gdb is always set.Sterling Augustine2019-09-051-2/+3
| | | | | | libc++abi also uses this file, but doesn't use the same CMakeLists.txt. llvm-svn: 371130
* [libcxx] Codesign test executables if necessaryVedant Kumar2019-09-055-11/+80
| | | | | | | | | If LLVM_CODESIGNING_IDENTITY is set, test executables need to be codesigned. Differential Revision: https://reviews.llvm.org/D66496 llvm-svn: 371126
* Add testing infrastructure to check if gdb is available for testing.Sterling Augustine2019-09-053-1/+15
| | | | | | | | | | | | Reviewers: echristo, EricWF Subscribers: mgorny, christof, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67194 llvm-svn: 371120
* [libc++] Revert "Make `vector` unconditionally move elements when exceptions ↵Louis Dionne2019-09-053-82/+10
| | | | | | | | | | are disabled." This reverts r370502, which broke the use case of a copy-only T (with a deleted move constructor) when exceptions are disabled. Until we figure out the right behavior, I'm reverting the commit. llvm-svn: 371068
* [libc++] Add a test for resizing of a vector with copy-only elementsLouis Dionne2019-09-051-0/+45
| | | | | | See https://reviews.llvm.org/D62228#1658620 llvm-svn: 371067
* Reformat the beginning of the testing doc to make clear how to run all the ↵Marshall Clow2019-09-051-5/+8
| | | | | | tests. llvm-svn: 371001
* [libc++] Only build with -fvisibility=hidden on ClangLouis Dionne2019-09-041-1/+7
| | | | | | | | | | | | | The visibility annotations in libc++ are not quite right for GCC, which results in symbols not being exported when -fvisibility=hidden is used. To fix the GCC build bots, this commit reverts to the previous state of not building with hidden visibility on GCC. In the future, we can build with hidden visibility all the time and export symbols explicitly using a list. See https://llvm.org/D66970 for one take at this. llvm-svn: 370926
* [libc++] Move __clamp_to_integral to <cmath>, and harden against min()/max() ↵Louis Dionne2019-09-043-34/+55
| | | | | | macros llvm-svn: 370900
* [libc++] Add `__truncating_cast` for safely casting float types to integersLouis Dionne2019-09-042-0/+124
| | | | | | | | | | | This is needed anytime we need to clamp an arbitrary floating point value to an integer type. Thanks to Eric Fiselier for the patch. Differential Revision: https://reviews.llvm.org/D66836 llvm-svn: 370891
* [libc++] Use __extension__ in a portable mannerLouis Dionne2019-09-042-1/+9
| | | | llvm-svn: 370889
* [libc++] Mark usage of _Atomic with __extension__Louis Dionne2019-09-031-1/+1
| | | | | | | | | An upcoming change in Clang will flag _Atomic as being a C11 extension. To avoid generating this warning in libc++, this commit marks the only use of _Atomic with the __extension__ extension, which suppresses such warnings. llvm-svn: 370796
* [libc++] Fix directory_iterator compilation on Win32Nico Weber2019-08-311-6/+6
| | | | | | | | | | | | This patch fixes some typos and other small errors in directory_iterator.cpp that prevented this file from being compiled for Win32. Patch by Stefan Schmidt <thrimbor.github@gmail.com>! Differential Revision: https://reviews.llvm.org/D66986 llvm-svn: 370599
* Revert "Add gdb pretty printers for a wide variety of libc++ data structures."Sterling Augustine2019-08-313-1735/+0
| | | | | | This reverts commit d8c9f2f572fe06a34ccfc28ee9223b64d7d275d3. llvm-svn: 370553
* Add gdb pretty printers for a wide variety of libc++ data structures.Sterling Augustine2019-08-303-0/+1735
| | | | | | | | | | | | | | | | | | | | Summary: Also add a test suite. Reviewers: EricWF Subscribers: christof, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65609 Run a pep8 formatter. Run pep8 formatter. Convert to PEP8, address other comments from code review. llvm-svn: 370551
* Make `vector` unconditionally move elements when exceptions are disabled.Eric Fiselier2019-08-303-10/+82
| | | | | | | | | | | | | | | | | | | | | | | | Summary: `std::vector<T>` is free choose between using copy or move operations when it needs to resize. The standard only candidates that the correct exception safety guarantees are provided. When exceptions are disabled these guarantees are trivially satisfied. Meaning vector is free to optimize it's implementation by moving instead of copying. This patch makes `std::vector` unconditionally move elements when exceptions are disabled. This optimization is conforming according to the current standard wording. There are concerns that moving in `-fno-noexceptions`mode will be a surprise to users. For example, a user may be surprised to find their code is slower with exceptions enabled than it is disabled. I'm sympathetic to this surprised, but I don't think it should block this optimization. Reviewers: mclow.lists, ldionne, rsmith Reviewed By: ldionne Subscribers: zoecarver, christof, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D62228 llvm-svn: 370502
* [libc++] Fix visibility of __vector_base_common on GCCLouis Dionne2019-08-281-1/+1
| | | | | | | | | | | Since we build the library with -fvisibility=hidden, the shared object wouldn't contain __vector_base_common<true>::__throw_length_error() and __vector_base_common<true>::__throw_out_of_range(), leading to link errors. This only happened on GCC for some reason. https://llvm.org/PR43140 llvm-svn: 370240
* [libc++] Add yet another test for inverted character classesLouis Dionne2019-08-271-0/+3
| | | | | | | | This was reported as part of a bug report that ended up being a duplicate for r340609, but I'm adding the test case since it's ever so slightly different from what we had before. llvm-svn: 370109
* [libc++] Fix typo in documentation for LIBCXX_HERMETIC_STATIC_LIBRARYLouis Dionne2019-08-231-1/+1
| | | | | | | Thanks to Yichen Yan for the patch. Differential Revision: https://reviews.llvm.org/D66675 llvm-svn: 369800
* [libc++] Improve Python 3 compatibility for merge_archives.pyLouis Dionne2019-08-231-1/+2
| | | | | | | | | | | | Popen.communicate() method in Python 2 returns a pair of strings, and in Python 3 it returns a pair of byte-like objects unless universal_newlines is set to True. This led to an error when using Python 3. With this patch, merge_archives.py works fine with Python 3. Thanks to Sergej Jaskiewicz for the patch. Differential Revision: https://reviews.llvm.org/D66649 llvm-svn: 369764
* libcxx: Make gen_link_script.py print contents only in --dryrun modeNico Weber2019-08-231-2/+3
| | | | | | | | | | | The build should generally be quiet if there are no errors, and this script has been around long enough that we can remove the log output. If we ever need to debug something with this script, we can put back the logging then. Differential Revision: https://reviews.llvm.org/D66594 llvm-svn: 369757
* [libc++] Fix broken <random> testLouis Dionne2019-08-221-16/+23
| | | | | | | | | | | | In r369429, I hoisted a floating point computation to a variable in order to remove a warning. However, it turns out this doesn't play well with floating point arithmetic. This commit reverts r369429 and instead casts the result of the floating point computation to remove the warning. Whether hoisting the computaiton to a variable should give the same result can be investigated independently. llvm-svn: 369693
* [libc++] Mark lock_guard nodiscard test as unsupported in C++03Louis Dionne2019-08-221-0/+3
| | | | llvm-svn: 369672
* libcxx: Rename last two .hpp files in libcxx to .hNico Weber2019-08-2110-13/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D66544 llvm-svn: 369597
* [libcxx] Only declare contents of threading API whenDavid Spickett2019-08-211-2/+5
| | | | | | | | | | | _LIBCPP_HAS_THREAD_API_EXTERNAL is not defined. When it is defined they will be declared by the __external_threading header instead. Differential revision: https://reviews.llvm.org/D66518 llvm-svn: 369537
* libcxx: Rename .hpp files in libcxx/benchmarks to .hNico Weber2019-08-2113-25/+25
| | | | | | | | LLVM uses .h as its extension for header files. Differential Revision: https://reviews.llvm.org/D66509 llvm-svn: 369487
* Fix missing __muloti4 function with UBSANEric Fiselier2019-08-211-1/+1
| | | | llvm-svn: 369483
* Attempt to fix MSAN failures in benchmarksEric Fiselier2019-08-211-1/+7
| | | | llvm-svn: 369482
* libcxx: Rename .hpp files in libcxx/test/support to .hNico Weber2019-08-21447-723/+723
| | | | | | | | | | | | | | | | | | | | | | | | | | LLVM uses .h as its extension for header files. Files renamed using: for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done References to the files updated using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do a=$(basename $f); echo $a; rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/"; done HPP include guards updated manually using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do echo ${f%.hpp}.h ; done | xargs mvim Differential Revision: https://reviews.llvm.org/D66104 llvm-svn: 369481
* Add a missing _VSTD:: before a call to merge. Fixes PR43034. Checked the ↵Marshall Clow2019-08-201-1/+1
| | | | | | rest of 'algorithm' looking for unqualified calls. Didn't find any. llvm-svn: 369463
* Fix a couple of unguarded operator, calls in algorithm. Fixes PR#43063. ↵Marshall Clow2019-08-2013-13/+106
| | | | | | Updated all the heap tests to check this. llvm-svn: 369448
OpenPOWER on IntegriCloud