summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* [libc++] Mark <filesystem> tests as failing when the dylib doesn't support ↵Louis Dionne2019-03-202-8/+14
| | | | | | | | | | | | filesystem This fixes CI for back-deployment testers on platforms that don't have <filesystem> support in the dylib. This is effectively half of https://reviews.llvm.org/D59224. The other half requires fixes in Clang. llvm-svn: 356558
* Add visibility attributes and inline to some vector methods.Eric Fiselier2019-03-191-3/+8
| | | | | | | Adding filesystem to the dylib caused some vector symbols to leak into the set of exported symbols. This patch hides those symbols. llvm-svn: 356502
* [libc++] Mark internal types of std::filesystem as hiddenLouis Dionne2019-03-191-3/+3
| | | | | | | | | | | | | | | | | | Summary: Otherwise, implicit instantiations of templates with these types can cause the dylib to start exporting the vtable/RTTI of the instantiation. Giving hidden visibility to those types causes the compiler to understand that they are not used outside the dylib, and as a result implicitly instantiated vtables/RTTI of templates with those internal types will get hidden visibility. Reviewers: EricWF Subscribers: christof, jkorous, dexonsmith, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D59550 llvm-svn: 356488
* Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. ↵Marshall Clow2019-03-194-26/+26
| | | | | | These are just rebranded 'operator[]', and should be noexcept like it is. llvm-svn: 356435
* Remove exception throwing debug mode handler support.Eric Fiselier2019-03-187-112/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The reason libc++ implemented a throwing debug mode handler was for ease of testing. Specifically, I thought that if a debug violation aborted, we could only test one violation per file. This made it impossible to test debug mode. Which throwing behavior we could test more! However, the throwing approach didn't work either, since there are debug violations underneath noexcept functions. This lead to the introduction of `_NOEXCEPT_DEBUG`, which was only noexcept when debug mode was off. Having thought more and having grown wiser, `_NOEXCEPT_DEBUG` was a horrible decision. It was viral, it didn't cover all the cases it needed to, and it was observable to the user -- at worst changing the behavior of their program. This patch removes the throwing debug handler, and rewrites the debug tests using 'fork-ing' style death tests. Reviewers: mclow.lists, ldionne, thomasanderson Reviewed By: ldionne Subscribers: christof, arphaman, libcxx-commits, #libc Differential Revision: https://reviews.llvm.org/D59166 llvm-svn: 356417
* Mark vector::operator[] and front/back as noexcept. We already do this for ↵Marshall Clow2019-03-151-8/+8
| | | | | | string and string_view. This should give better codegen inside of noexcept functions. Add tests for op[]/front/back/at, because apparently we had none. llvm-svn: 356224
* Add noexcept to operator[] for array and deque. This is an extension. We ↵Marshall Clow2019-03-142-8/+8
| | | | | | already do this for string and string_view. This should give better codegen inside of noexcept functions. llvm-svn: 356209
* Add std::midpoint for integral and poiner types. Described in P0811, ↵Marshall Clow2019-03-141-0/+35
| | | | | | reviewed as D59099. llvm-svn: 356162
* Properly constrain basic_string(Iter, Iter, Alloc = A())Eric Fiselier2019-03-141-4/+4
| | | | llvm-svn: 356140
* [libc++] Enable deprecation warnings by defaultLouis Dionne2019-03-121-2/+4
| | | | | | | | | | | | | | | | | | | Summary: In r342843, I added deprecation warnings to some facilities that were deprectated in C++14 and C++17. However, those deprecation warnings were not enabled by default. After discussing this on IRC, we had finally gotten consensus to enable those warnings by default, and I'm getting around to doing that only now. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D58140 llvm-svn: 355961
* Allow optional to tolerate being used with a nested class.Eric Fiselier2019-03-111-3/+7
| | | | | | | | | | | | | | | When Clang tries to complete a type containing `std::optional` it considers the `in_place_t` constructor with no arguments which checks if the value type is default constructible. If the value type is a nested class type, then this check occurs too early and poisons the is_default_constructible trait. This patch makes optional deduce `in_place_t` so we can prevent this early SFINAE evaluation. Technically this could break people doing weird things with the in_place_t tag, but that seems less important than making the nested class case work. llvm-svn: 355877
* [libc++] Remove empty header xlocale/xlocale.hLouis Dionne2019-03-112-1/+0
| | | | | | | | | | | | | | Summary: I can't think of a reason for shipping this empty header. If there is a reason to do so, then hopefully this review can uncover it. Reviewers: mclow.lists, EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D59137 llvm-svn: 355829
* Work around dllimport bug with exclude_from_explicit_instantiation.Eric Fiselier2019-03-081-0/+3
| | | | | | | | | | | | When dllimport is specified on a class, and exclude_from_explicit_instatiation is specified on a member, clang-cl will still expect a definition to be available externally. But this is not correct. Surprisingly one one symbol seems to be consistently affected by this bug. So this patch simply works around it there. llvm-svn: 355760
* Fix C++03 build failureEric Fiselier2019-03-081-1/+1
| | | | llvm-svn: 355758
* Unbork `std::memory_order` ABI.Eric Fiselier2019-03-081-6/+29
| | | | | | | | | | | | | | | | | | | Summary: We need to pin the underlying type of C++20' `std::memory_order` to match the C++17 version. Anything less is an ABI break. At the moment it's `unsigned` before C++20 and `int` after. Or if you're using `-fshort-enums` it's `unsigned char` before C++20 and `int` after. This patch explicitly specifies the underlying type of the C++20 `memory_order` to be w/e type the compiler would have chosen for the C++17 version. Reviewers: mclow.lists, ldionne Reviewed By: ldionne Subscribers: jfb, jdoerfert, #libc, zoecarver Differential Revision: https://reviews.llvm.org/D59063 llvm-svn: 355755
* Fix PR41017 - Build failure with _LIBCPP_DEBUG=0 and non-const-refEric Fiselier2019-03-081-5/+5
| | | | | | | | | | | comparator for std::sort() Our debug comparator assumed that the comparator it wraps would always accepts the values by const ref. This isn't required by the standard. This patch makes our __debug_less comparator forward the constness. llvm-svn: 355752
* [libc++] Fix use-after-free when building with _LIBCPP_DEBUG=1Thomas Anderson2019-03-061-41/+47
| | | | | | | | | | | | | | | | | | | | | | | The issue is the following code: __cn1->__add(*__ip); (*__ip)->__c_ = __cn1; `__ip` points into the array of iterators for container `__cn2`. This code adds the iterator to the array of iterators for `__cn1`, and updates the iterator to point to the new container. This code works fine, except when `__cn1` and `__cn2` are the same container. `__cn1->__add()` might need to grow the array of iterators, and when it does, `__ip` becomes invalid, so the second line becomes a use-after-free error. Simply swapping the order of the above two lines is not sufficient, because of the memmove() below. The easiest and most performant solution is just to skip touching any iterators if the containers are the same. Differential Revision: https://reviews.llvm.org/D58926 llvm-svn: 355550
* Fix ABI compatibility of `<stdexcept>` with VCRuntime.Eric Fiselier2019-03-061-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently, libc++'s `<stdexcept>` doesn't play nice with `vcruntime`. Specifically: * `logic_error` and `runtime_error` have a different layout. * libc++'s `logic_error` and `runtime_error` override `what()` but `vcruntime` does not. * `vcruntime` uses weak vtables for `<stdexcept>` types. * libc++'s `<stdexcept>` constructors and assignment operators may have different manglings than `vcruntimes`. This patch makes libc++'s declarations in `<stdexcept>` match those provided by MSVC's STL as closely as possible. If MSVC doesn't declare a special member, then neither do we. This ensures that the implicit definitions have the same linkage, visibility, triviality, and noexcept-ness. Reviewers: thomasanderson, ldionne, smeenai Reviewed By: thomasanderson Subscribers: jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D58945 llvm-svn: 355546
* [libc++] Do not specify the underlying type of memory_orderLouis Dionne2019-03-061-8/+2
| | | | | | | | | | | | | | | | Summary: This breaks ABI for folks using -fshort-enums, and does not really buy us anything. http://llvm.org/PR40977 Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits, zoecarver Differential Revision: https://reviews.llvm.org/D59029 llvm-svn: 355521
* Eradicate all the ptrdiff_ts in span left over from applying P1227. A couple ↵Marshall Clow2019-03-061-41/+40
| | | | | | of other minor cleanups. NFC llvm-svn: 355481
* Reinstate libc++ patches now that the lldb formatter has been updated.Davide Italiano2019-03-052-255/+806
| | | | | | | | "[libc++] Fix <atomic> failures on GCC" "[libc++] Change memory_order to an enum class" "[libc++] decoupling Freestanding atomic<T> from libatomic.a" llvm-svn: 355427
* [libcxx] Revert set of atomic patches that broke lldb.Davide Italiano2019-03-052-806/+255
| | | | | | | | | | | Revert "[libc++] Fix <atomic> failures on GCC" Revert "[libc++] Change memory_order to an enum class" Revert "[libc++] decoupling Freestanding atomic<T> from libatomic.a" The lldb formatter nededs to be updated. Shafik and Louis will coordinate to do so. llvm-svn: 355417
* [libc++] Fix <atomic> failures on GCCLouis Dionne2019-03-051-86/+86
| | | | | | | | | | | | | | | | Summary: In https://reviews.llvm.org/D58201, we turned memory_order into an enum class in C++20 mode. However, we were not casting memory_order to its underlying type correctly for the GCC implementation, which broke the build bots. I also fixed a test that was failing in C++17 mode on GCC 5. Reviewers: EricWF, jfb, mclow.lists Subscribers: zoecarver Differential Revision: https://reviews.llvm.org/D58966 llvm-svn: 355409
* [libc++] Change memory_order to an enum classLouis Dionne2019-03-051-50/+82
| | | | | | | | | This implements P0439R0. Thanks to Zoe Carver for the patch. Differential Revision: https://reviews.llvm.org/D58201 llvm-svn: 355403
* Fix -fsanitize=vptr badness in <__debug>Eric Fiselier2019-03-051-3/+9
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes a lifetime bug when inserting a new container into the debug database. It is diagnosed by UBSAN when debug mode is enabled. This patch corrects how nodes are constructed during insertion. The fix requires unconditionally breaking the debug mode ABI. Users should not expect ABI stability from debug mode. Reviewers: ldionne, serge-sans-paille, EricWF Reviewed By: EricWF Subscribers: mclow.lists, christof, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D58011 llvm-svn: 355367
* Make VCRuntime ABI configuration a first-class option.Eric Fiselier2019-03-054-16/+16
| | | | | | | | | | | | | | | | | | | | | | | Summary: On Windows we currently provide two separate ABI configurations. One which defers to `vcruntime` to provide the C++ runtime and another which doesn't. Using `vcruntime` allows interoperability which programs compiled against the MSVC STL, and should be preferred whenever possible. When deferring to `vcruntime` much of the ABI we provide changes. Including the layout of `<stdexcept>` types, their vtables, and how the linkage of their members. This patch introduces the `_LIBCPP_ABI_VCRUNTIME` macro to denote this configuration. It also cleans up the existing configuration for using `vcruntime`. This cleanup lays the groundwork for fixing a number of ABI and interoperability bugs in `<stdexcept>`. Reviewers: thomasanderson, ldionne, smeenai Reviewed By: smeenai Subscribers: jdoerfert, libcxx-commits, #libc Differential Revision: https://reviews.llvm.org/D58942 llvm-svn: 355366
* [libc++] decoupling Freestanding atomic<T> from libatomic.aLouis Dionne2019-03-042-240/+759
| | | | | | | | | | | This patch introduces non-lockfree atomics that do not require using an external libatomic. This work is done with the long-term goal of allowing the use of <atomic> in freestanding environments. Thanks to Olivier Giroux for the patch. Differential Revision: https://reviews.llvm.org/D56913 llvm-svn: 355318
* [libc++] Add is_nothrow_convertible from P0758R1Louis Dionne2019-02-271-0/+29
| | | | | | | Reviewed as https://reviews.llvm.org/D58019. Thanks to Zoe Carver for the patch. llvm-svn: 355010
* [libc++] Remove visibility-related warnings with Clang 8Louis Dionne2019-02-272-8/+4
| | | | | | | The attributes were placed incorrectly -- they need to be after the "struct" keyword, not before. llvm-svn: 355006
* I changed a 'enable_if<...>::type to' 'enable_if_t<...>' but forgot to ↵Marshall Clow2019-02-271-1/+1
| | | | | | remove the preceding 'typename' llvm-svn: 354995
* Implment the last part of P1024: tuple-like interface to span. Reviewed as ↵Marshall Clow2019-02-271-8/+40
| | | | | | https://reviews.llvm.org/D58706. llvm-svn: 354988
* In the review of D58642, Louis asked: 'Is there a reason for making this ↵Marshall Clow2019-02-271-33/+33
| | | | | | inline? Templates are already inline by default'. I told him that I didn't want to change the one call (ssize) that I was adding, but would come back later and clean them all (data/empty/begin/end/cbegin/cend/rbegin/rend/crbegin/crend/size/ssize) up later. Now it is later. Remove the unnecessary 'inline' modifiers from all these calls. llvm-svn: 354952
* Implement the second part of P1227R2 - Signed ssize() functions. Reviewed as ↵Marshall Clow2019-02-271-0/+18
| | | | | | https://reviews.llvm.org/D58642 llvm-svn: 354950
* First part of P1227R2 - change span over to use 'size_t' instead of ↵Marshall Clow2019-02-272-33/+29
| | | | | | 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639. llvm-svn: 354936
* Implement P1357: Traits for [Un]bounded Arrays; adopted in KonaMarshall Clow2019-02-261-0/+29
| | | | llvm-svn: 354891
* [libc++] Rename _NOALIAS macro to _LIBCPP_NOALIASLouis Dionne2019-02-262-6/+6
| | | | | | | | | | | | | | Summary: For consistency, libc++ macros always start with _LIBCPP. This should have no functionality change. Reviewers: EricWF, mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D58558 llvm-svn: 354848
* LWG3101 - span's Container constructors need another constraint. Reviewed as ↵Marshall Clow2019-02-251-14/+0
| | | | | | https://reviews.llvm.org/D57058. llvm-svn: 354805
* Commit LWG3144 - span does not have a const_pointer typedef. Reviewed as D57039.Marshall Clow2019-02-251-4/+6
| | | | llvm-svn: 354802
* First part of P1024: Usability Enhancements for std::span. Remove operator() ↵Marshall Clow2019-02-251-7/+21
| | | | | | for indexing, and add 'front' and 'back' calls. llvm-svn: 354801
* Fix the build with gcc when `-Wredundant-decls` is passedDimitry Andric2019-02-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: gcc warns that `__throw_runtime_error` is declared both in `<__locale>` and `<stdexcept>`, if `-Wredundant-decls` is passed on the command line; this is the case with FreeBSD when ${WARNS} == 6. Since `<__locale>` gets its first declaration via a transitive include of `<stdexcept>`, and the second declaration is after the first invocation of `__throw_runtime_error`, delete that second declaration. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com> Reviewers: kristina, MaskRay, EricWF, ldionne, ngie Reviewed By: EricWF Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D58425 llvm-svn: 354515
* [libc++] Avoid UB in the no-exceptions mode in a few placesLouis Dionne2019-02-123-12/+14
| | | | | | | | | | | | | | | | | | | | | | | Summary: A few places in the library seem to behave unexpectedly when the library is compiled or used with exceptions disabled. For example, not throwing an exception when a pointer is NULL can lead us to dereference the pointer later on, which is UB. This patch fixes such occurences. It's hard to tell whether there are other places where the no-exceptions mode misbehaves like this, because the replacement for throwing an exception does not always seem to be abort()ing, but at least this patch will improve the situation somewhat. See http://lists.llvm.org/pipermail/libcxx-dev/2019-January/000172.html Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D57761 llvm-svn: 353850
* Don't declare fenv.h functions when they're a macro.Eric Fiselier2019-02-121-100/+11
| | | | | | | libc still provides function declarations, and these declarations conflict with libc++'s llvm-svn: 353774
* Add fenv.h headerEric Fiselier2019-02-113-1/+209
| | | | | | | | | | | | | | | | | Summary: Some implementations of fenv.h use macros to define the functions they provide. This can cause problems when `std::fegetround()` is spelled in source. This patch adds a `fenv.h` header to libc++ for the sole purpose of turning those macros into real functions. Reviewers: rsmith, mclow.lists, ldionne Reviewed By: rsmith Subscribers: mgorny, christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D57729 llvm-svn: 353767
* fix -Wextra-semi warningsEric Fiselier2019-02-101-5/+5
| | | | llvm-svn: 353650
* Add static_asserts to tuple's comparison operators to enforce the ↵Marshall Clow2019-02-071-0/+2
| | | | | | requirement that the tuples be the same size. See PR39183 for an example where we give unexpected results for this bad input case. With this change, we will reject it at compile-time llvm-svn: 353450
* Add UBSAN annotation to __hash_table::rehash; we don't do anything wrong, ↵Marshall Clow2019-02-071-0/+1
| | | | | | but UBSAN's checker flags it as suspicious. See PR38606. NFC llvm-svn: 353448
* Add a specialization for '__unwrap_iter' to handle const interators. This ↵Marshall Clow2019-02-061-0/+12
| | | | | | enables the 'memmove' optimization for std::copy, etc. llvm-svn: 353311
* [NFC][libc++] Reindent functionLouis Dionne2019-02-051-4/+2
| | | | llvm-svn: 353180
* add a test and a couple minor bug fixes for the ↵Marshall Clow2019-02-012-2/+2
| | | | | | implicit-signed-integer-truncation sanitizer. This is PR#40566 llvm-svn: 352926
* [libc++] Disentangle the 3 implementations of type_infoLouis Dionne2019-02-011-31/+75
| | | | | | | | | | | | | | | | | | | | | | | | Summary: We currently have effectively 3 implementations of type_info: one for the Microsoft ABI, one that does not assume that there's a unique copy of each RTTI in a progran, and one that assumes a unique copy. Those 3 implementations are entangled into the same class with nested ifdefs, which makes it very difficult to understand. Furthermore, the benefit of doing this is rather small since the code that is duplicated across implementations is just a couple of trivial lines. This patch stamps out the 3 versions of type_info explicitly to increase readability. It also explains what's going on with short comments, because it's far from obvious. Reviewers: EricWF, mclow.lists Subscribers: christof, jkorous, dexonsmith Differential Revision: https://reviews.llvm.org/D57606 llvm-svn: 352905
OpenPOWER on IntegriCloud