summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* [libc++] Check hash before calling __hash_table key_eq functionKwasi Mensah2016-07-081-2/+2
| | | | | | | | | | | | Summary: The current implementations of __hash_table::find used by std::unordered_set/unordered_map call key_eq on each key that lands in the same bucket as the key you're looking for. However, since equal objects mush hash to the same value, you can short-circuit the possibly expensive call to key_eq by checking the hashes first. Reviewers: EricWF Subscribers: kmensah, cfe-commits Differential Revision: http://reviews.llvm.org/D21510 llvm-svn: 274857
* Improve performance of unordered_set<uint32_t>::find by 45%. Add benchmarks.Eric Fiselier2016-07-021-2/+4
| | | | | | | | | | | | | | | | This patch improves the performance of unordered_set's find by 45% when the value exists within the set. __hash_tables find method needs to check if it's reached the end of the bucket by constraining the hash of the current node and checking it against the bucket index. However constraining the hash is an expensive operations and it can be avoided if the two unconstrained hashes are equal. This patch applies that optimization. This patch also adds a top level directory called benchmarks. 'benchmarks/' is intended to store any/all benchmarks written for the standard library. Currently nothing is done with files under 'benchmarks/' but I would like to move towards introducing a formal format and test runner. llvm-svn: 274423
* Handle std::get<T>(...) for std::tuple<>Eric Fiselier2016-07-021-0/+5
| | | | llvm-svn: 274422
* Rewrite std::get<Type>(...) helper using constexpr functions.Eric Fiselier2016-07-021-28/+28
| | | | llvm-svn: 274418
* Cleanup SFINAE in tuple, and add tests for reference assignmentEric Fiselier2016-07-021-30/+17
| | | | llvm-svn: 274414
* Make tuple_constructible and family lazy again.Eric Fiselier2016-07-021-3/+9
| | | | llvm-svn: 274413
* Flatten tuple_constructible, tuple_convertible and tuple_assignable.Eric Fiselier2016-07-012-82/+40
| | | | | | | | | | | | | | | | This patch is the last in a series that replaces recursive meta-programming in std::tuple with non-recursive implementations. Previously std::tuple could only be instantiated with 126 elements before it blew the max template instantiation depth. Now the size of std::tuple is essentially unbounded (I've tested with over 5000 elements). One unfortunate side-effect of this change is that tuple_constructible and similar no longer short circuit after the first failure. Instead they evaluate the conditions for all elements. This could be potentially breaking. I plan to look into this further. llvm-svn: 274331
* Flatten the tuple_element and __make_tuple_types implementations.Eric Fiselier2016-07-011-33/+105
| | | | | | | | | | This patch attempts to improve the QoI of std::tuples tuple_element and __make_tuple_types helpers. Previously they required O(N) instantiations, one for every element in the tuple The new implementations are O(1) after __tuple_indices<Id...> is created. llvm-svn: 274330
* Replace __make_tuple_indices implementation with superior implementation.Eric Fiselier2016-06-302-77/+81
| | | | | | | | | | | | | | | | | The previous __make_tuple_indices implementation caused O(N) instantiations and was pretty inefficient. The C++14 __make_integer_sequence implementation is much better, since it either uses a builtin to generate the sequence or a very nice Log8(N) implementation provided by richard smith. This patch moves the __make_integer_sequence implementation into __tuple and uses it to implement __make_tuple_indices. Since libc++ can't expose the name 'integer_sequence' in C++11 this patch also introduces a dummy type '__integer_sequence' which is used when generating the sequence. One the sequence is generated '__integer_sequence' can be converted into the required type; either '__tuple_indices' or 'integer_sequence'. llvm-svn: 274286
* Fix static assert problem on gcc; remove XFAILs that I put in in r274250Marshall Clow2016-06-302-6/+6
| | | | llvm-svn: 274285
* Implement LWG#2441: 'Exact-width atomic typedefs should be provided'Marshall Clow2016-06-301-0/+18
| | | | llvm-svn: 274236
* Implement LWG#2436: 'Comparators for associative containers should always be ↵Marshall Clow2016-06-302-0/+6
| | | | | | CopyConstructible' llvm-svn: 274235
* Fix ::reference typedef in insert iterators.Eric Fiselier2016-06-301-6/+6
| | | | | | | | | | | | Since at least the C++11 standard insert iterators are specified as having ::reference typedef void. Libc++ was not doing that. This patch corrects the typedef. This patch changes the std::iterator base class of insert_iterator, front_insert_iterator and back_insert_iterator. This should not be an ABI breaking change. llvm-svn: 274209
* Implement P0163r0. Add shared_ptr::weak_type.Eric Fiselier2016-06-272-1/+5
| | | | | | | | | | This patch adds the weak_type typedef in shared_ptr. It is available in C++17 and newer. This patch also updates the _LIBCPP_STD_VER and TEST_STD_VER macros to have the value of 16, since 2016 is the current year. llvm-svn: 273839
* Implement p0337r0. Delete operator= for polymorphic_allocator.Eric Fiselier2016-06-271-1/+1
| | | | llvm-svn: 273838
* Implement P0358r1. Fixes for not_fn.Eric Fiselier2016-06-271-2/+17
| | | | llvm-svn: 273837
* Fix PR27115 - enable_shared_from_this does not work as a virtual base class.Eric Fiselier2016-06-261-24/+23
| | | | | | | | | | | | | See https://llvm.org/bugs/show_bug.cgi?id=27115 The problem was that the conversion from 'const enable_shared_from_this<T>*' to 'const T*' didn't work if T inherited enable_shared_from_this as a virtual base class. The fix is to take the original pointer passed to shared_ptr's constructor in the __enable_weak_this method and perform an upcast to 'const T*' instead of performing a downcast from the enable_shared_from_this base. llvm-svn: 273835
* Fix PR28079 - std::wstring_convert move constructor broken.Eric Fiselier2016-06-261-1/+1
| | | | | | | | | | | | | The move constructor for wstring_convert accidentally copied the state member into the converted count member in the move constructor. This patch fixes the typo. While working on this I discovered that wstring_convert doesn't actually provide a move constructor according to the standard and therefore this constructor is a libc++ extension. I'll look further into whether libc++ should provide this constructor at all. Neither libstdc++ or MSVC's STL provide it. llvm-svn: 273831
* Implement LWG 2488 - Make the placeholders constexpr.Eric Fiselier2016-06-261-10/+23
| | | | | | | | | | | | | | | | | | | This patch makes the bind placeholders in std::placeholders both (1) const and (2) constexpr (See below). This is technically a breaking change for any code using the placeholders outside of std::bind and depending on them being non-const. However I don't think this will break any real world code. (1) Previously the placeholders were non-const extern globals in all dialects. This patch changes these extern globals to be const in all dialects. Since the cv-qualifiers don't participate in name mangling for globals this is an ABI compatible change. (2) Make the placeholders constexpr in C++11 and beyond. Although LWG 2488 only applies to C++17 I don't see any reason not to backport this change. llvm-svn: 273824
* [libcxx] guard throw with exception enabling checkWeiming Zhao2016-06-241-0/+8
| | | | | | | | | | | | Summary: this fixes build error when built with c++14 and no exceptions Reviewers: rmaprath Subscribers: weimingz, grandinj, rmaprath, cfe-commits Differential Revision: http://reviews.llvm.org/D21673 llvm-svn: 273697
* Fix PR27684 - std::tuple no longer accepts reference to incomplete type in ↵Eric Fiselier2016-06-211-1/+1
| | | | | | | | | | | | | | | | | some cases. Libc++ has to deduce the 'allocator_arg_t' parameter as 'AllocArgT' for the following constructor: template <class Alloc> tuple(allocator_arg_t, Alloc const&) Previously libc++ has tried to support tags derived from 'allocator_arg_t' by using 'is_base_of<AllocArgT, allocator_arg_t>'. However this breaks whenever a 2-tuple contains a reference to an incomplete type as its first parameter. See https://llvm.org/bugs/show_bug.cgi?id=27684 llvm-svn: 273334
* Implement LWG issue 2720. Replace perms::resolve_symlinks with ↵Eric Fiselier2016-06-211-1/+1
| | | | | | | | | | | | | | | perms::symlink_nofollow. This changes how filesystem::permissions(p, perms) handles symlinks. Previously symlinks were not resolved by default instead only getting resolved when "perms::resolve_symlinks" was used. After this change symlinks are resolved by default and perms::symlink_nofollow must be given to change this. This issue has not yet been moved to Ready status, and I will revert if it doesn't get moved at the current meeting. However I feel confident that it will and it's nice to have implementations when moving issues. llvm-svn: 273328
* Implement LWG issue 2725. The issue should move this meetingEric Fiselier2016-06-211-1/+3
| | | | llvm-svn: 273325
* Implement std::experimental::propagate_const from LFTS v2Jonathan Coe2016-06-192-0/+580
| | | | | | | | | | | | | Summary: An implementation of std::experimental::propagate_const from Library Fundamentals Technical Specification v2. No tests are provided for disallowed types like fancy pointers or function pointers as no code was written to handle these. Reviewers: EricWF, mclow.lists Differential Revision: http://reviews.llvm.org/D12486 llvm-svn: 273122
* Test commit; remove some spaces at EOL. No functional change.Marshall Clow2016-06-191-3/+3
| | | | llvm-svn: 273121
* Implement LWG issue 1169. num_get not fully compatible with strto*Eric Fiselier2016-06-193-8/+54
| | | | | | | | | | | Use strtof and strtod for floats and doubles respectively instead of always using strtold. The other parts of the change are already implemented in libc++. This patch also has a drive by fix to wbuffer_convert::underflow() which prevents it from calling memmove(buff, null, 0). llvm-svn: 273106
* Enable building and using atomic shared_ptr for GCC.Eric Fiselier2016-06-181-4/+3
| | | | | | | | | | | | | | | | | Summary: Currently the implementation of [util.smartptr.shared.atomic] is provided only when using Clang, and not with GCC. This is a relic of not having a GCC implementation of <atomic>, even though <atomic> isn't actually used in the implementation. This patch enables support for atomic shared_ptr functions when using GCC. Note that this is not a header only change. Previously only Clang builds of libc++.so would provide the required symbols. There is no reason for this restriction. After this change both Clang and GCC builds should be binary compatible with each other WRT these symbols. Reviewers: mclow.lists, rmaprath, EricWF Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21407 llvm-svn: 273076
* Add missing space between >> in template declaration. Fixes C++03 build.Eric Fiselier2016-06-171-1/+1
| | | | llvm-svn: 273037
* Add Filesystem TS -- CompleteEric Fiselier2016-06-173-6/+2085
| | | | | | | | | | | | | | Add the completed std::experimental::filesystem implementation and tests. The implementation supports C++11 or newer. The TS is built as part of 'libc++experimental.a'. Users of the TS need to manually link this library. Building and testing the TS can be disabled using the CMake option '-DLIBCXX_ENABLE_FILESYSTEM=OFF'. Currently 'libc++experimental.a' is not installed by default. To turn on the installation of the library use '-DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON'. llvm-svn: 273034
* Fix const default initialization of lock_guard<>Eric Fiselier2016-06-151-1/+1
| | | | llvm-svn: 272804
* Partially Revert r272613. FreeBSD needs the non-trivial constructors in pair.Eric Fiselier2016-06-142-8/+28
| | | | llvm-svn: 272671
* Implement variadic lock_guard.Eric Fiselier2016-06-143-3/+108
| | | | | | | | | | | | | | | | | | | | Summary: This patch implements the variadic `lock_guard` paper. Making `lock_guard` variadic is a ABI breaking change because the specialization `lock_guard<_Mutex>` mangles differently then when it was the primary template. This change only provides variadic `lock_guard` in ABI V2 or when `_LIBCPP_ABI_VARIADIC_LOCK_GUARD` is defined. Note that in ABI V2 `lock_guard` must always be declared as a variadic template, even in C++03, in order to keep the ABI consistent. For this reason `lock_guard` is forward declared as a variadic template in all standard dialects and therefore depends on variadic templates being provided as an extension in C++03. All supported versions of Clang and GCC provide this extension. Reviewers: mclow.lists Subscribers: K-ballo, mclow.lists, cfe-commits Differential Revision: http://reviews.llvm.org/D21260 llvm-svn: 272634
* Remove _LIBCPP_TRIVIAL_PAIR_COPY_CTOR option.Eric Fiselier2016-06-142-28/+8
| | | | llvm-svn: 272613
* [streambuf] Added call to traits_type::copy to common case in xsgetn()Evandro Menezes2016-06-101-2/+12
| | | | | | | | | Patch by Laman Sole <laxman.g@partner.samsung.com>, Sebastian Pop <s.pop@samsung.com>, Aditya Kumar <aditya.k7@samsung.com> Differential Revision: http://reviews.llvm.org/D21103 llvm-svn: 272401
* Don't call memmove when there's nothing to move. Fixes PR#27978.Marshall Clow2016-06-041-1/+3
| | | | llvm-svn: 271794
* Fix leak in __enable_weak_this(). Thanks to Arthur O'Dwyer for finding it.Eric Fiselier2016-06-021-2/+4
| | | | llvm-svn: 271487
* Add C++17 std::not_fn negator.Eric Fiselier2016-06-021-2/+47
| | | | | | | | | | | | | | | Summary: Exactly what it sounds like. I plan to commit this in a couple of days assuming no objections. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20799 llvm-svn: 271464
* Implement P0033R1 - Re-enabling shared_from_thisEric Fiselier2016-06-021-1/+11
| | | | | | | | | | | | Summary: See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0033r1.html Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19254 llvm-svn: 271449
* Cleanup non-standard tests as reported by STL@microsoft.com. NFC.Eric Fiselier2016-06-011-3/+3
| | | | | | | | | | | | | | | This patch addresses the following issues in the test suite: 1. Move "std::bad_array_length" test from std/ to libcxx/ test directory since the feature is not a part of the standard. 2. Rename "futures.tas" test directory to "futures.task" since that is the correct stable name. 3. Move tests for "packaged_task<T>::result_type" from std/ to libcxx/ test directory since the typedef is a libc++ extension. llvm-svn: 271430
* Mark LWG issue 2276 as complete. Add _LIBCPP_ASSERTS for itEric Fiselier2016-05-311-0/+2
| | | | llvm-svn: 271247
* Make string_view work with -fno-exceptions and get tests passing.Eric Fiselier2016-05-301-3/+4
| | | | llvm-svn: 271237
* Cleanup error handling when TLS creation failsEric Fiselier2016-05-301-3/+1
| | | | llvm-svn: 271235
* Fix PR27751. Add proper dependancies for install-libcxx-headers ruleEric Fiselier2016-05-271-1/+2
| | | | llvm-svn: 271073
* [libcxx] Allow explicit pthread opt-inBen Craig2016-05-253-6/+11
| | | | | | | | | | | | | | | The existing pthread detection code in __config is pretty good for common operating systems. It doesn't allow cmake-time choices to be made for uncommon operating systems though. This change adds the LIBCXX_HAS_PTHREAD_API cmake flag, which turns into the _LIBCPP_HAS_THREAD_API_PTHREAD preprocessor define. This is a name change from the old _LIBCPP_THREAD_API_PTHREAD. The lit tests want __config_site.in variables to have a _LIBCPP_HAS prefix. http://reviews.llvm.org/D20573 llvm-svn: 270735
* Reorganize locale extension fallbacks. NFCIBen Craig2016-05-205-207/+225
| | | | | | | | | | | | | | | | | | | | | | | The various _l locale extension functions originate from very different places. Some come from POSIX, some are BSD extensions, and some are shared BSD and GLIBC extensions. This patch tries to group the local extension reimplementations by source. This should make it easier to make libcxx work with POSIX compliant C libraries that lack these extensions. The fallback locale functions are also useful on their own for other lightweight platforms. Putting these fallback implementations in support/xlocale should enable code sharing. I have no access to a newlib system or an android system to build and test with. I _do_ have access to a system without any of the _l locale extensions though, and I was able to ensure that the new __posix_l_fallback.h and __strtonum_fallback.h didn't have any massive problems. http://reviews.llvm.org/D17416 llvm-svn: 270213
* Cleanup superfluous std:: qualifiers in <type_traits>Eric Fiselier2016-05-181-7/+7
| | | | llvm-svn: 269998
* Optimize declval for compile times. Patch from Eric Niebler.Eric Fiselier2016-05-181-1/+4
| | | | | | | | | This patch implements the C++11 version of declval without requiring a template instantiation. See PR27798 for more information. https://llvm.org/bugs/show_bug.cgi?id=27798 llvm-svn: 269991
* Change the control flow in atomic_compare_exchange_strong to avoid a ↵Marshall Clow2016-05-181-0/+3
| | | | | | | | potential deadlock. When you assign a shared_ptr, the deleter gets called and assigned. In this routine, the assignment happens inside a critical section, which could (potentially) lead to a deadlock, if the deleter did something wonky. Now we swap the old value with an (empty) temporary shared_ptr, and then let the temporary delete the old value when it goes out of scope (after the lock has been released). This should fix PR#27724. Thanks to Hans Boehm for the bug report and the suggested fix. llvm-svn: 269965
* Implement LWG2576: istream_iterator and ostream_iterator should use ↵Marshall Clow2016-05-171-4/+4
| | | | | | std::addressof llvm-svn: 269789
* Implement P0030R1: Introduce a 3-Argument Overload to std::hypotMarshall Clow2016-05-171-0/+28
| | | | llvm-svn: 269772
OpenPOWER on IntegriCloud