summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
* [CMake] Create a separate install target for libcxx headersChris Bieneman2016-04-291-2/+12
| | | | | | This change doesn't impact the behavior of the install-libcxx target which installs whichever libcxx components you build, it just adds a separate target to just install the headers. llvm-svn: 268124
* Fix PR21428 for long. Buffer was one byte too small in octal formatting ↵Eric Fiselier2016-04-291-1/+1
| | | | | | case. Rename previously added test llvm-svn: 268009
* Cleanup: move visibility/linkage attributes to the first declaration.Evgeniy Stepanov2016-04-2211-111/+214
| | | | | | http://reviews.llvm.org/D15404 llvm-svn: 267093
* Fix LWG issue #2106: move_iterators returning prvaluesEric Fiselier2016-04-221-1/+6
| | | | llvm-svn: 267091
* Add is_swappable/is_nothrow_swappable traitsEric Fiselier2016-04-218-42/+133
| | | | llvm-svn: 267079
* Make ios_base::failure visibility specified consistentEric Fiselier2016-04-211-1/+1
| | | | llvm-svn: 267076
* Fix most GCC attribute ignored warningsEric Fiselier2016-04-218-27/+22
| | | | llvm-svn: 267074
* [libc++] fix macro redef warning when exception is disabledWeiming Zhao2016-04-211-1/+1
| | | | | | | | | | | | | Summary: when setting LIBCXX_ENABLE_EXCEPTIONS=false, _LIBCPP_NO_EXCEPTIONS wil be defined in both commandline and _config Reviewers: bcraig, EricWF Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19344 llvm-svn: 266956
* [libcxx] Fix PR15638 - Only allocate in parent when starting a thread to ↵Eric Fiselier2016-04-201-17/+33
| | | | | | | | | | | | | | | | | | | | | prevent calling terminate. Summary: Hi, When creating a new thread libc++ performs at least 2 allocations. The first allocates a tuple of args and the functor that will be passed to the new thread. The second allocation is for the thread local storage needed internally by libc++. Currently the second allocation happens in the child thread, meaning that if it throws the program will terminate with an uncaught bad alloc. The solution to this is to allocate ALL memory in the parent thread and then pass it to the child. See https://llvm.org/bugs/show_bug.cgi?id=15638 Reviewers: mclow.lists, danalbert, jroelofs, EricWF Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13748 llvm-svn: 266851
* Add 'is_callable' and 'is_nothrow_callable' traits and cleanup INVOKE.Eric Fiselier2016-04-203-167/+237
| | | | | | | | | | | | The primary purpose of this patch is to add the 'is_callable' traits. Since 'is_nothrow_callable' required making 'INVOKE' conditionally noexcept I also took this oppertunity to implement a constexpr version of INVOKE. This fixes 'std::experimental::apply' which required constexpr 'INVOKE support'. This patch will be followed up with some cleanup. Primarly removing most of "__member_function_traits" since it's no longer used by INVOKE (in C++11 at least). llvm-svn: 266836
* Include initializer_list from utilityBen Craig2016-04-191-0/+1
| | | | | | | The C++11 and C++14 standards both say in the header <utility> synopsis that <utility> shall include <initializer_list>. llvm-svn: 266808
* Make tuples constructors conditionally EXPLICIT. See N4387Eric Fiselier2016-04-191-9/+100
| | | | llvm-svn: 266703
* Mark LWG issue 2469 as done. Also simplify try_emplace and insert_or_assign ↵Eric Fiselier2016-04-181-63/+31
| | | | | | implementations in unordered_map llvm-svn: 266591
* Implement LWG issue 2219 - support reference_wrapper in INVOKEEric Fiselier2016-04-183-16/+72
| | | | llvm-svn: 266590
* Add hash specializations for __int128_t. Fixes LWG issue 2119Eric Fiselier2016-04-181-0/+16
| | | | llvm-svn: 266587
* Fix LWG issue 2345 - Add insert(value_type&&)Eric Fiselier2016-04-182-82/+91
| | | | llvm-svn: 266585
* Teach map/unordered_map how to optimize 'emplace(Key, T)'.Eric Fiselier2016-04-163-0/+47
| | | | | | | | | In cases where emplace is called with two arguments and the first one matches the key_type we can Key to check for duplicates before allocating. This patch expands on work done by dexonsmith@apple.com. llvm-svn: 266498
* Extract key to avoid preemptive mallocs in insert/emplace in associative ↵Eric Fiselier2016-04-154-22/+93
| | | | | | | | | | | | | | containers Summary: This patch applies Duncan's work on __hash_table to __tree. Reviewers: mclow.lists, dexonsmith Subscribers: dexonsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D18637 llvm-svn: 266491
* Cleanup and guard tuple's constructor SFINAE. Fixes PR22806 and PR23256.Eric Fiselier2016-04-151-45/+158
| | | | | | | | | | | | | | | | | | | | | There are two main fixes in this patch. First the constructor SFINAE was changed so that it's evaluated in two stages where the first stage evaluates the "safe" SFINAE conditions and the second evaluates the "dangerous" ones. The key is that the second stage is lazily evaluated only if the first stage passes. This helps fix PR23256 (https://llvm.org/bugs/show_bug.cgi?id=23256). The second fix is for PR22806 and LWG issue 2549. This fix applies the suggested resolution to the LWG issue in order to prevent the construction of dangling references. The SFINAE for this check is contained within the _PreferTupleLikeConstructor alias template. The tuple-like constructors are disabled whenever that trait returns false. (https://llvm.org/bugs/show_bug.cgi?id=22806) (http://cplusplus.github.io/LWG/lwg-active.html#2549) llvm-svn: 266461
* [libcxx] Remove the "reduced-arity-initialization" extension from the ↵Eric Fiselier2016-04-151-15/+18
| | | | | | | | | | | | | | | | | uses-allocator constructors Summary: A default uses-allocator constructor has been added since that overload was previously provided by the extended constructor. Since Clang does implicit conversion checking after substitution this constructor has to deduce the allocator_arg_t parameter so that it can prevent the evaluation of "is_default_constructible" if the first argument doesn't match. See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1391 for more information. This patch fixes PR24779 (https://llvm.org/bugs/show_bug.cgi?id=24779) Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19006 llvm-svn: 266409
* Qualify calls to addressof to avoid getting ADL. Fixes PR#27254.Marshall Clow2016-04-132-12/+12
| | | | llvm-svn: 266209
* Implement LWG#680, which was missed lo these many moons ago, and was ↵Marshall Clow2016-04-111-6/+3
| | | | | | reported as bug #27259. As a drive-by fix, replace the hand-rolled equivalent to addressof in __wrap_iter with the real thing. llvm-svn: 265914
* Recommit r263036 with additional inlining, so that it will continue to work ↵Marshall Clow2016-04-071-2/+22
| | | | | | with existing system dylibs. Implements LWG#2583 llvm-svn: 265706
* Fix bug #27260 - add missing swap(reference, reference) to vector<bool>.Marshall Clow2016-04-071-0/+1
| | | | llvm-svn: 265672
* Remove unused internal routines. No functional changeMarshall Clow2016-04-041-28/+0
| | | | llvm-svn: 265363
* Put back the undefs that Richard removed. Boost won't build w/o these; ↵Marshall Clow2016-04-041-0/+57
| | | | | | specifically the file 'bytes_methods.h' in Apple's python framework defines these. llvm-svn: 265358
* Fix for Bug #27193; 'std::acos on complex does not agree with C'. Tests need ↵Marshall Clow2016-04-041-1/+1
| | | | | | work; so the bug will stay open. llvm-svn: 265306
* Fix LWG issue 2469 - Use piecewise construction in map::operator[].Eric Fiselier2016-03-311-67/+40
| | | | | | | | | | | | | | | map's allocator may only be used to construct objects of 'value_type', or in this case 'pair<const Key, Value>'. In order to respect this requirement in operator[], which requires default constructing the 'mapped_type', we have to use pair's piecewise constructor with '(tuple<Kep>, tuple<>)'. Unfortunately we still need to provide a fallback implementation for C++03 since we don't have <tuple>. Even worse this fallback is the last remaining user of '__hash_map_node_destructor' and '__construct_node_with_key'. This patch also switches try_emplace over to __tree.__emplace_unique_key_args. llvm-svn: 264989
* Teach __tree how to handle map's __value_typeEric Fiselier2016-03-313-456/+377
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is fairly large and contains a number of changes. The changes all work towards allowing __tree to properly handle __value_type esspecially when inserting into the __tree. I chose not to break this change into smaller patches because it wouldn't be possible to write meaningful standard-compliant tests for each patch. It is very similar to r260513 "[libcxx] Teach __hash_table how to handle unordered_map's __hash_value_type". Changes in <map> * Remove __value_type's constructors because it should never be constructed directly. * Make map::emplace and multimap::emplace forward to __tree and remove the old definitions * Remove "__construct_node" map and multimap member functions. Almost all of the construction is done within __tree. * Fix map's move constructor to access "__value_type.__nc" directly and pass this object to __tree::insert. Changes in <__tree> * Add traits to detect, handle, and unwrap, map's "__value_type". * Convert methods taking "value_type" to take "__container_value_type" instead. Previously these methods caused unwanted implicit conversions from "std::pair<Key, Value>" to "__value_type<Key, Value>". * Delete __tree_node and __tree_node_base's constructors and assignment operators. The node types should never be constructed because the "__value_" member of __tree_node must be constructed directly by the allocator. * Make the __tree_node_destructor class and "__construct_node" methods unwrap "__node_value_type" into "__container_value_type" before invoking the allocator. The user's allocator can only be used to construct and destroy the container's value_type. Passing it map's "__value_type" was incorrect. * Cleanup the "__insert" and "__emplace" methods. Have __insert forward to an __emplace function wherever possible to reduce code duplication. __insert_unique(value_type const&) and __insert_unique(value_type&&) forward to __emplace_unique_key_args. These functions will not allocate a new node if the value is already in the tree. * Change the __find* functions to take the "key_type" directly instead of passing in "value_type" and unwrapping the key later. This change allows the find functions to be used without having to construct a "value_type" first. This allows for a number of optimizations. * Teach __move_assign and __assign_multi methods to unwrap map's __value_type. llvm-svn: 264986
* Implement is_always_lock_freeJF Bastien2016-03-251-11/+32
| | | | | | | | | | | | | | | | | | Summary: This was voted into C++17 at the Jacksonville meeting. The final P0152R1 paper will be in the upcoming post-Jacksonville mailing, and is also available here: http://jfbastien.github.io/papers/P0152R1.html Reviewers: mclow.lists, rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17951 llvm-svn: 264413
* unord: Extract key to avoid preemptive mallocs in insert/emplaceDuncan P. N. Exon Smith2016-03-171-2/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | unordered_set::emplace and unordered_map::emplace construct a node, then try to insert it. If insertion fails, the node gets deleted. To avoid this unnecessary malloc traffic, check to see if the argument to emplace has the appropriate key_type. If so, we can use that key directly and delay the malloc until we're sure we're inserting something new. Test updates by Eric Fiselier, who rewrote the old allocation tests to include the new cases. There are two orthogonal future directions: 1. Apply the same optimization to set and map. 2. Extend the optimization to when the argument is not key_type, but can be converted to it without side effects. Ideally, we could do this whenever key_type is trivially destructible and the argument is trivially convertible to key_type, but in practise the relevant type traits "blow up sometimes". At least, we should catch a few simple cases (such as when both are primitive types). llvm-svn: 263746
* Make std::addressof constexpr in C++17 (Clang only).Eric Fiselier2016-03-172-0/+20
| | | | llvm-svn: 263688
* Add __unconstref for future useEric Fiselier2016-03-161-0/+5
| | | | llvm-svn: 263659
* Add clang thread safety annotations to mutex and lock_guard. Patch by ↵Eric Fiselier2016-03-162-8/+21
| | | | | | | | | | | | | | | jamesr@google.com. This adds clang thread safety annotations to std::mutex and std::lock_guard so code using these types can use these types directly instead of having to wrap the types to provide annotations. These checks when enabled by -Wthread-safety provide simple but useful static checking to detect potential race conditions. See http://clang.llvm.org/docs/ThreadSafetyAnalysis.html for details. This patch was reviewed in http://reviews.llvm.org/D14731. llvm-svn: 263611
* Implement LWG2577: {shared,unique}_lock</tt> should use std::addressofMarshall Clow2016-03-142-12/+12
| | | | llvm-svn: 263506
* Implement LWG#2566: Requirements on the first template parameter of ↵Marshall Clow2016-03-142-1/+4
| | | | | | container adaptors llvm-svn: 263450
* Disable CFI checks in std::addressof.Evgeniy Stepanov2016-03-111-1/+1
| | | | | | | | std::addressof may be used on a storage of an object before the start of its lifetime (see std::allocate_shared for example). CFI flags the C-style cast as invalid in that case. llvm-svn: 263310
* Revert r263036, it's ABI-breaking.Nico Weber2016-03-111-20/+2
| | | | llvm-svn: 263246
* Implement LWG#2579: Inconsistency wrt Allocators in basic_string assignment ↵Marshall Clow2016-03-091-10/+2
| | | | | | vs. basic_string::assign llvm-svn: 263042
* Implement LWG#2583: There is no way to supply an allocator for ↵Marshall Clow2016-03-091-2/+20
| | | | | | basic_string(str, pos) llvm-svn: 263036
* Split locale management out of locale_win32. NFCIBen Craig2016-03-092-18/+35
| | | | | | | | | | | | | | | | | | For the locale refactor, the locale management functions (newlocale, freelocale, uselocale) are needed in a separate header from the various _l functions. This is because some platforms implement the _l functions in terms of a locale switcher RAII helper, and the locale switcher RAII helper needs the locale management functions. This patch helps pave the way by getting all the functions in the right files, so that later diffs aren't completely horrible. Unfortunately, the Windows, Cygwin, and MinGW builds seemed to have bit-rotted, so I wasn't able to test this completely. I don't think I made things any worse than they already are though. http://reviews.llvm.org/D17419 llvm-svn: 263020
* Reorganize _LIBCPP_LOCALE__L_EXTENSIONSBen Craig2016-03-093-260/+192
| | | | | | | | | | | | | | | | Instead of checking _LIBCPP_LOCALE_L_EXTENSIONS all over, instead check it once, and define the various *_l symbols once. The private redirector symbol names are all prefixed with _libcpp_* so that they won't conflict with user symbols, and so they won't conflict with future C library symbols. In particular, glibc likes providing private symbols such as __locale_t, so we should follow a different naming pattern (like _libcpp_*) to avoid problems on that front. Tested on Linux with glibc. Hoping for the best on OSX and the various BSDs. http://reviews.llvm.org/D17456 llvm-svn: 263016
* Implement P0272R1: Give 'std::string' a non-const '.data()' member functionMarshall Clow2016-03-081-0/+5
| | | | llvm-svn: 262931
* Implement P0253R1: Fixing a design mistake in the searchers interface.Marshall Clow2016-03-084-40/+47
| | | | llvm-svn: 262928
* Implement P0025R0: 'An algorithm to clamp a value between a pair of boundary ↵Marshall Clow2016-03-071-0/+27
| | | | | | values' for C++17 llvm-svn: 262871
* non-member swap for array was mistakenly taking const ref params. Fixed and ↵Marshall Clow2016-03-071-1/+1
| | | | | | added test. Thanks to Ben Craig for the catch llvm-svn: 262866
* Fix for PR26812: possible overflow issue in std::allocator::allocateMarshall Clow2016-03-031-2/+18
| | | | llvm-svn: 262610
* Another chunk of N4089Marshall Clow2016-02-251-19/+2
| | | | llvm-svn: 261894
* Fix __is_referenceable to work with vector types. Fixes PR#26654 and 26656. ↵Marshall Clow2016-02-221-26/+7
| | | | | | Thanks to Evgeniy for the reports, and to Eric for the suggestion on how to fix it. llvm-svn: 261581
* Rename <__hash_table> traits so they don't conflict with similar traits.Eric Fiselier2016-02-201-7/+7
| | | | | | In particular <__tree> defines many of the same types of traits classes. llvm-svn: 261421
OpenPOWER on IntegriCloud