summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix PR28506. Re-enable missing math.h C++11 decls on SunOS. Patch from ↵Eric Fiselier2016-08-152-47/+24
| | | | | | Michal Gorny. llvm-svn: 278716
* Check in SFINAE base class for use in optional/variantEric Fiselier2016-08-151-0/+57
| | | | llvm-svn: 278643
* Add 'inline' attribute to __init to inline the basic_string's constructorSebastian Pop2016-08-111-0/+5
| | | | | | | | | | | | basic_string's constructor calls init which was not getting inlined. This prevented optimization of const string as init would appear as a call in between a string's def and use. Patch by Laxman Sole and Aditya Kumar. Differential Revision: https://reviews.llvm.org/D22782 llvm-svn: 278356
* [libcxx] Add std::anyEric Fiselier2016-08-111-0/+658
| | | | | | | | | | | | | | | | | | | Summary: This patch adds std::any by moving/adapting <experimental/any>. This patch also implements the std::any parts of p0032r3 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0032r3.pdf) and LWG 2509 (http://cplusplus.github.io/LWG/lwg-defects.html#2509). I plan to push it in a day or two if there are no comments. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22733 llvm-svn: 278310
* Implement LWG 2148: Make non-enum default hash specialization well-formedEric Fiselier2016-08-101-4/+14
| | | | | | | | | | | | | | | | | Summary: This patch removes the static_assert for non-enum types in the primary hash template. Instead non-enum types create a hash<T> specialization that is not constructible nor callable. See also: * http://cplusplus.github.io/LWG/lwg-active.html#2543 * https://llvm.org/bugs/show_bug.cgi?id=28917 Reviewers: mclow.lists, EricWF Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D23331 llvm-svn: 278300
* std:: quailfy the calls for cend/crend/cbegin/cend. Fixes bug 28927.Marshall Clow2016-08-101-8/+8
| | | | llvm-svn: 278282
* [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctorHubert Tong2016-08-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: The synopsis in C++11 subclause 28.8 [re.regex] has: ``` basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript); ``` The default argument is added to libc++ by this change. Reviewers: mclow.lists, rsmith, hubert.reinterpretcast Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22702 Reapplies r277966. Patch by Jason Liu! llvm-svn: 277968
* Revert r277966. Forgot patch attribution.Hubert Tong2016-08-071-2/+2
| | | | llvm-svn: 277967
* [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctorHubert Tong2016-08-071-2/+2
| | | | | | | | | | | | | | | | | | | Summary: The synopsis in C++11 subclause 28.8 [re.regex] has: ``` basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript); ``` The default argument is added to libc++ by this change. Reviewers: mclow.lists, rsmith, hubert.reinterpretcast Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22702 llvm-svn: 277966
* [libcxx] basic_regex: add traits_type, string_typeHubert Tong2016-08-021-0/+4
| | | | | | | | | | | | | | | | | Summary: In the synopsis in C++11 subclause 28.8 [re.regex], `basic_regex` is specified to have member typedefs `traits_type` and `string_type`. This change adds them to libc++. Reviewers: mclow.lists, rsmith, hubert.reinterpretcast Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22698 Patch by Jason Liu! llvm-svn: 277526
* Add a bunch of noexcepts to char_traits and string_view.Marshall Clow2016-07-282-37/+37
| | | | llvm-svn: 276955
* Implement LCM and GCD for C++17. Same code as for Library Fundamentals TS.Marshall Clow2016-07-262-2/+64
| | | | llvm-svn: 276751
* Implement LCM and GCD for Library Fundamentals. Reviewed as ↵Marshall Clow2016-07-261-0/+103
| | | | | | https://reviews.llvm.org/D21343. llvm-svn: 276750
* Implement the std::pair parts of "Improving pair and tuple". Completes N4387.Eric Fiselier2016-07-253-144/+236
| | | | llvm-svn: 276605
* Recommit r276548 - Make pair/tuples assignment operators SFINAE properly.Eric Fiselier2016-07-252-12/+52
| | | | | | | I think I've solved issues with is_assignable and references to incomplete types. The updated patch adds tests for this case. llvm-svn: 276603
* Make std::is_assignable tolerate references to incomplete types.Eric Fiselier2016-07-251-16/+5
| | | | llvm-svn: 276599
* Revert r276548 - Make pair/tuples assignment operators SFINAE properly.Eric Fiselier2016-07-252-42/+5
| | | | | | | | | | | | This is a breaking change. The SFINAE required is instantiated the second the class is instantiated, and this can cause hard SFINAE errors when applied to references to incomplete types. Ex. struct IncompleteType; extern IncompleteType it; std::tuple<IncompleteType&> t(it); // SFINAE will blow up. llvm-svn: 276598
* Don't SFINAE pair's copy assignment operator in C++03 mode.Eric Fiselier2016-07-251-0/+4
| | | | | | | | In C++03 mode evaluating the SFINAE can cause a hard error due to access control violations. This is a problem because the SFINAE is evaluated as soon as the class is instantiated, and not later. llvm-svn: 276594
* Add __is_inplace_type metafunction helperEric Fiselier2016-07-241-0/+5
| | | | llvm-svn: 276556
* Skip chash computation in insert/emplace if the unconstrained hash matches.Eric Fiselier2016-07-241-1/+1
| | | | llvm-svn: 276549
* Make pair/tuples assignment operators SFINAE properly.Eric Fiselier2016-07-242-5/+38
| | | | llvm-svn: 276548
* Implement LWG2328. Rvalue stream extraction should perfect forward.Eric Fiselier2016-07-241-2/+2
| | | | llvm-svn: 276545
* Implement P0040r3: Extending memory management toolsEric Fiselier2016-07-241-0/+108
| | | | llvm-svn: 276544
* Implement the in_place tags from p0032r3.Eric Fiselier2016-07-231-0/+58
| | | | | | | That paper also has changes to any/optional but those will be implemented later. llvm-svn: 276537
* Fix undefined behavior in __hash_tableEric Fiselier2016-07-233-237/+232
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch attempts to fix the undefined behavior in __hash_table by changing the node pointer types used throughout. The pointer types are changed for raw pointers in the current ABI and for fancy pointers in ABI V2 (since the fancy pointer types may not be ABI compatible). The UB in `__hash_table` arises because tree downcasts the embedded end node and then deferences that pointer. Currently there are 2 node types in __hash_table: * `__hash_node_base` which contains the `__next_` pointer. * `__hash_node` which contains `__hash_` and `__value_`. Currently the bucket list, iterators, and `__next_` pointers store pointers to `__hash_node` even though they all need to store `__hash_node_base` pointers. This patch makes that change by introducing a `__next_pointer` typedef which is a pointer to `__hash_node` in the current ABI and `__hash_node_base` afterwards. One notable change is to the type of `__bucket_list` which used to be defined as `unique_ptr<__node_pointer[], ...>` and is now `unique_ptr<__next_pointer[], ...>` meaning that we now allocate and deallocate different types using a different allocator. I'm going to give this part of the change more thought since it may introduce compatibility issues. This change is similar to D20786. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D20787 llvm-svn: 276533
* Implement P0392r0. Integrate filesystem::path and string_view.Eric Fiselier2016-07-231-21/+43
| | | | llvm-svn: 276511
* Revert r276506 - Diagnose invalid memory order arguments in <atomic>.Eric Fiselier2016-07-231-78/+0
| | | | | | | | There is a bug in Clang 3.6 and earlier that causes compile failures. I suspect it's due to the usage of member function parameter names in the attributes. llvm-svn: 276507
* [libcxx] Diagnose invalid memory order arguments in <atomic>. Fixes PR21179.Eric Fiselier2016-07-231-0/+78
| | | | | | | | | | | | | | | Summary: This patch uses the __attribute__((enable_if)) hack suggested by @rsmith to diagnose invalid arguments when possible. In order to diagnose an invalid argument `m` to `f(m)` we provide an additional overload of `f` that is only enabled when `m` is invalid. When that function is enabled it uses __attribute__((unavailable)) to produce a diagnostic message. Reviewers: mclow.lists, rsmith, jfb, EricWF Subscribers: bcraig, jfb, rsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D22557 llvm-svn: 276506
* Remove FIXME for feature test macroJF Bastien2016-07-211-1/+0
| | | | | | The value I'd picked was correct, as per the recently published SG10 paper http://wg21.link/p0096r3 llvm-svn: 276309
* Fix some string_view tests that were failing when exceptions were disabled. ↵Marshall Clow2016-07-211-3/+3
| | | | | | Also comment out a _LIBCPP_ASSERT that gcc4.9 was complaining about. Will revisit that later. llvm-svn: 276241
* Implement std::string_view as described in http://wg21.link/P0254R1. ↵Marshall Clow2016-07-215-717/+1786
| | | | | | Reviewed as https://reviews.llvm.org/D21459 llvm-svn: 276238
* Implement P0084r2. Changing emplace return types.Eric Fiselier2016-07-216-30/+37
| | | | llvm-svn: 276230
* Move std::function constructor SFINAE into template parameter list. Fixes ↵Eric Fiselier2016-07-201-19/+10
| | | | | | | | | PR20002. Although inheriting constructors have already been fixed in Clang 3.9 I still choose to fix std::function so users can derive from it with older compilers. llvm-svn: 276090
* Reimplement is_constructible fallback implementation. Fixes PR21574.Eric Fiselier2016-07-201-92/+48
| | | | | | | The previous implementation relied highly on specializations to handle special cases. This new implementation lets the compiler do the work when possible. llvm-svn: 276084
* Add tests for reference binding assertions in std::tuple.Eric Fiselier2016-07-201-36/+20
| | | | | | | | | | | | Libc++ provides static assertions to detect reference binding issues inside tuple. This patch adds tests for those diagnostics. It should be noted that these static assertions technically violate the standard since it allows these illegal bindings to occur. Also see https://llvm.org/bugs/show_bug.cgi?id=20855 llvm-svn: 276078
* Add SFINAE on additional overloads of std::complex functions. Fixes PR19921.Eric Fiselier2016-07-201-145/+60
| | | | | | | | | | The functions arg, conj, imag, norm, proj, and real have additional overloads for arguments of integral or floating point types. However these overloads should not allow conversions to the integral/floating point types, only exact matches. This patch constrains these functions so they no longer allow conversions. llvm-svn: 276067
* Add heterogeneous comparator support for __debug_less. Fixes PR17147.Eric Fiselier2016-07-191-1/+15
| | | | llvm-svn: 276059
* Fix undefined behavior in __treeEric Fiselier2016-07-192-187/+259
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch attempts to fix the undefined behavior in __tree by changing the node pointer types used throughout. The pointer types are changed for raw pointers in the current ABI and for fancy pointers in ABI V2 (since the fancy pointer types may not be ABI compatible). The UB in `__tree` arises because tree downcasts the embedded end node and then deferences that pointer. Currently there are 3 node types in __tree. * `__tree_end_node` which contains the `__left_` pointer. This node is embedded within the container. * `__tree_node_base` which contains `__right_`, `__parent_` and `__is_black`. This node is used throughout the tree rebalancing algorithms. * `__tree_node` which contains `__value_`. Currently `__tree` stores the start of the tree, `__begin_node_`, as a pointer to a `__tree_node`. Additionally the iterators store their position as a pointer to a `__tree_node`. In both of these cases the pointee can be the end node. This is fixed by changing them to store `__tree_end_node` pointers instead. To make this change I introduced an `__iter_pointer` typedef which is defined to be a pointer to either `__tree_end_node` in the new ABI or `__tree_node` in the current one. Both `__tree::__begin_node_` and iterator pointers are now stored as `__iter_pointers`. The other situation where `__tree_end_node` is stored as the wrong type is in `__tree_node_base::__parent_`. Currently `__left_`, `__right_`, and `__parent_` are all `__tree_node_base` pointers. Since the end node will only be stored in `__parent_` the fix is to change `__parent_` to be a pointer to `__tree_end_node`. To make this change I introduced a `__parent_pointer` typedef which is defined to be a pointer to either `__tree_end_node` in the new ABI or `__tree_node_base` in the current one. Note that in the new ABI `__iter_pointer` and `__parent_pointer` are the same type (but not in the old one). The confusion between these two types is unfortunate but it was the best solution I could come up with that maintains the ABI. The typedef changes force a ton of explicit type casts to correct pointer types and to make current code compatible with both the old and new pointer typedefs. This is the bulk of the change and it's really messy. Unfortunately I don't know how to avoid it. Please let me know what you think. Reviewers: howard.hinnant, mclow.lists Subscribers: howard.hinnant, bbannier, cfe-commits Differential Revision: https://reviews.llvm.org/D20786 llvm-svn: 276003
* Bump version # to 4.0.0Marshall Clow2016-07-181-1/+1
| | | | llvm-svn: 275904
* Don't use pthread initializers in constexpr constructors. Patch by elram. ↵Marshall Clow2016-07-181-5/+14
| | | | | | Reviewed at https://reviews.llvm.org/D21637. llvm-svn: 275819
* Change a couple ifdefs from '#if __cplusplus >= 2011xxx' to '#ifndef ↵Marshall Clow2016-07-183-9/+9
| | | | | | _LIBCPP_CXX03_LANG'. No functionality change. llvm-svn: 275787
* Rename and rework `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR`. Move FreeBSD ↵Eric Fiselier2016-07-182-24/+27
| | | | | | | | | | | | | | | | | | configuration in-tree. This patch does the following: * It renames `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR` to `_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR`. * It automatically enables this option on FreeBSD in ABI V1, since that's the current ABI FreeBSD ships. * It cleans up the handling of this option in `std::pair`. I would like the sign off from the FreeBSD maintainers. They will no longer need to keep their `__config` changes downstream. I'm still hoping to come up with a better way to maintain the ABI without needing these constructors. Reviewed in https://reviews.llvm.org/D21329 llvm-svn: 275749
* Implement C++17 tuple bits. Including apply and make_from_tuple.Eric Fiselier2016-07-181-1/+53
| | | | | | | | | | This patch upgrades <tuple> to be C++17 compliant by implementing: * tuple_size_v: This was forgotten when implementing the other _v traits. * std::apply: This was added via LFTS v1 in p0220r1. * std::make_from_tuple: This was added in p0209r2. llvm-svn: 275745
* Check for unconstrained hash equality before constrained hash equality.Eric Fiselier2016-07-171-2/+3
| | | | | | | | | | | | | | This patch implements a simple optimization in __hash_table::find. When iterating the found bucket we only constrain the bucket elements hash if it doesn't already match the unconstrained hash of the specified key. This prevent the performance of an expensive modulo operation. Since the bucket element almost always matches the key, especially when the load factor is low, this optimization has large performance impacts. For a unordered_set<int> of random integers this patch improves the performance of 'find(...)' by 40%. llvm-svn: 275734
* Constuct a sentry object in istream::readsome, and handle failures ↵Marshall Clow2016-07-131-11/+28
| | | | | | appropriately. Fixes PR#28217. llvm-svn: 275280
* Add option to disable __deallocate #warningSaleem Abdulrasool2016-07-122-0/+6
| | | | | | | | | | | | | | From r229162: Visual Studio's SAL extension uses a macro named __deallocate. This macro is used pervasively Using -Werror when building for Windows can force the use of -Wno-#warnings specifically because of this __deallocate #warning. Instead of forcing builds to disable all #warnings, this option allows libc++ to be built without this particular warning, while leaving other #warnings enabled. Patch by Dave Lee! llvm-svn: 275172
* Don't compute modulus of hash if it is smaller than the bucket count.Eric Fiselier2016-07-111-5/+4
| | | | | | | | This cleans up a previous optimization attempt in hash, and results in additional performance improvements over that previous attempt. Additionally this new optimization does not hinder the power of 2 bucket count optimization. llvm-svn: 275114
* Always use the allocator to construct/destruct elements of a deque/vector. ↵Marshall Clow2016-07-113-6/+26
| | | | | | Fixes PR#28412. Thanks to Jonathan Wakely for the report. llvm-svn: 275105
* Allow is_swappable to SFINAE on deleted/ambiguous swap functionsEric Fiselier2016-07-111-4/+9
| | | | llvm-svn: 275094
* Implement LWG685 (which is from C++11!). Fixes PR#28421. Note: this ↵Marshall Clow2016-07-081-2/+123
| | | | | | (subtly) changes the return type of operator-(Iter1, Iter2) where Iter1 is a reverse iterator or a move_iterator, and Iter2 is some other move/reverse iterator type. In practice, I believe that almost every time the second param will be const_XXX and this will mean that the return type will be the same as it was before. llvm-svn: 274880
OpenPOWER on IntegriCloud