Commit Graph

1741 Commits

Author SHA1 Message Date
Eric Fiselier
7ee34209c6 Add missed test in r276090.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276091 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 05:22:35 +00:00
Eric Fiselier
155b681794 Reimplement is_constructible fallback implementation. Fixes PR21574.
The previous implementation relied highly on specializations to handle
special cases. This new implementation lets the compiler do the work when possible.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276084 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 05:01:24 +00:00
Eric Fiselier
9c747b9e89 Add tests for reference binding assertions in std::tuple.
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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276078 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 02:57:39 +00:00
Eric Fiselier
781fb2a738 Add SFINAE on additional overloads of std::complex functions. Fixes PR19921.
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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276067 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 00:14:10 +00:00
Eric Fiselier
99029f12eb Add heterogeneous comparator support for __debug_less. Fixes PR17147.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276059 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19 23:27:18 +00:00
Eric Fiselier
7310ec83f3 Fix undefined behavior in __tree
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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276003 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19 17:56:20 +00:00
Eric Fiselier
066feb8249 Remove locale tests that depend on enviroment variables.
Constructing a std::locale object from an empty string selects the language
from the current environment variables. If the environment variables name
a locale that doesn't exist, or isn't installed, then the construction of
facets using that locale may throw.

This patch removes tests that use 'std::locale l("")'.

The optimal solution would be to manually set the environment variables
in the test. Unfortunately there is no portable way to do this.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275772 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 06:15:55 +00:00
Jonas Hahnfeld
b9c20327ac [libcxx][filesystem] Remove setgid from parent before testing permissions
man page for mkdir says: "If the parent directory has the set-group-ID bit set,
then so will the newly created directory."

Differential Revision: https://reviews.llvm.org/D22265

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275760 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 06:06:50 +00:00
Eric Fiselier
5432e3b9a1 Rework libatomic handling in CMake and LIT.
This patch updates the way libc++ handles checking for libatomic, in part
to prepare for https://reviews.llvm.org/D22073.

Changes:
* 'LIBCXX_HAS_ATOMIC_LIB' is now set whenever libatomic is available even libc++
   doesn't need to manually link it.
* 'LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB' is now used to detect when libatomic
   needs to be manually linked.
* 'LIBCXX_HAS_ATOMIC_LIB' now adds 'libatomic' as a available feature in the
   test suite.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275759 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 06:01:50 +00:00
Eric Fiselier
755baa9f4e Improve ABI tests for std::pair.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275757 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 04:48:37 +00:00
Eric Fiselier
f5750d5c05 Add checkpoint diagnostics to help diagnose buildbot failures.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275754 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 03:00:09 +00:00
Eric Fiselier
0751cc188f Prevent failures by marking Clock::is_steady tests as UNSUPPORTED: asan.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275753 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 02:29:33 +00:00
Eric Fiselier
9ae7274ea5 Add includes in test. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275751 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 02:05:31 +00:00
Eric Fiselier
c71c304663 Rename and rework _LIBCPP_TRIVIAL_PAIR_COPY_CTOR. Move FreeBSD 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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275749 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 01:58:37 +00:00
Eric Fiselier
c79e8b692d Suppress warning in make_from_tuple tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275748 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 01:52:46 +00:00
Eric Fiselier
5839fedf28 Implement C++17 tuple bits. Including apply and make_from_tuple.
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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275745 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 00:35:56 +00:00
Eric Fiselier
3e732e94ae Fix std::experimental::optional tests. Patch from Casey Carter.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275732 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-17 20:32:30 +00:00
Marshall Clow
211f9a485c Add more tests for LWG#2582. No code changes needed, just tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275211 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-12 20:15:46 +00:00
JF Bastien
f6752747db libc++: name anonymous structs
As discussed in http://reviews.llvm.org/D22073

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275210 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-12 20:14:52 +00:00
Marshall Clow
3f5435853f Add tests for the meta.unary.props that do not require a complete type. This is part of LWG#2582
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275184 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-12 15:50:53 +00:00
Marshall Clow
51d7e8e381 Always use the allocator to construct/destruct elements of a deque/vector. Fixes PR#28412. Thanks to Jonathan Wakely for the report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275105 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11 21:38:08 +00:00
Eric Fiselier
45e9a936b6 Allow is_swappable to SFINAE on deleted/ambiguous swap functions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275094 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11 19:57:13 +00:00
Marshall Clow
faa37d5de6 Fix typo in #ifdef; leave tests commented out b/c gcc 4.8 harks on them.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274882 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-08 16:59:54 +00:00
Manman Ren
8e83446812 Revert r274605 due to bot failure: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/244/
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274651 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-06 18:24:53 +00:00
Marshall Clow
8668189a1a Fix typo in #ifdef, and re-enable tests now that the green-dragon bots are no more
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274605 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-06 05:28:44 +00:00
Eric Fiselier
990090f2ad Handle std::get<T>(...) for std::tuple<>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274422 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-02 03:46:08 +00:00
Eric Fiselier
22c3e76205 Rewrite std::get<Type>(...) helper using constexpr functions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274418 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-02 03:18:30 +00:00
Eric Fiselier
5fb1e0ab01 Cleanup SFINAE in tuple, and add tests for reference assignment
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274414 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-02 01:25:46 +00:00
Eric Fiselier
cebaf5cbf8 Make tuple_constructible and family lazy again.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274413 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-02 00:58:17 +00:00
Eric Fiselier
e8b134c1bc Turn off ASAN's odr-violation diagnostics for now. See PR28391
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274404 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 23:25:47 +00:00
Eric Fiselier
053859ffc6 Flatten the tuple_element and __make_tuple_types implementations.
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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274330 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 03:54:54 +00:00
Marshall Clow
1a93312404 Fix static assert problem on gcc; remove XFAILs that I put in in r274250
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274285 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 22:05:45 +00:00
Eric Fiselier
3efb2c901e Fix C++03 build.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274274 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 20:46:58 +00:00
Marshall Clow
0b02cf8cf1 Implement LWG#2688: 'clamp misses preconditions and has extraneous condition on result'. We already did this, just added tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274252 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 17:52:51 +00:00
Marshall Clow
a0f496b989 Temporarily XFAIL the incomplete type tests for GCC while I figure out why adding a static_assert in r274235 broken them
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274250 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 17:49:36 +00:00
Marshall Clow
256814f751 Implement LWG#2684: 'priority_queue lacking comparator typedef'. We already did this, just added tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274243 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 16:03:50 +00:00
Marshall Clow
f0419f1dcc Implement LWG#2596: 'vector::data() should use addressof'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274241 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 15:50:55 +00:00
Marshall Clow
ca894508f9 Implement LWG#2441: 'Exact-width atomic typedefs should be provided'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274236 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 15:28:38 +00:00
Marshall Clow
0c99f18af4 Implement LWG#2436: 'Comparators for associative containers should always be CopyConstructible'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274235 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 15:11:53 +00:00
Eric Fiselier
b0ee61352f Make futures.overview enum tests more portable. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274211 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 05:00:32 +00:00
Eric Fiselier
0fc5603d78 Make std::array typedef tests more portable.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274210 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 04:54:00 +00:00
Eric Fiselier
c848cefa27 Fix ::reference typedef in insert iterators.
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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274209 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 04:40:50 +00:00
Eric Fiselier
8db06d71c2 Make instreambuf.iterator/types.pass.cpp more portable.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274207 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 04:31:09 +00:00
Eric Fiselier
68d0f230e9 Fix use of terse static assert. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274206 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 04:29:12 +00:00
Eric Fiselier
16715b9a88 Fix unary_function inheritance assumption. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274205 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 04:28:12 +00:00
Eric Fiselier
eb4c5e90a7 Fix unreferenced parameter warning. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274204 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 04:22:58 +00:00
Eric Fiselier
3a60979362 Avoid applying unary minus to unsigned integers. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274203 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 04:21:52 +00:00
Akira Hatanaka
70bf1c2280 [libcxx] Fix a bug in strstreambuf::overflow.
The end pointer should point to one past the end of the newly allocated
buffer.

rdar://problem/24265174

Differential Revision: http://reviews.llvm.org/D20334


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274132 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-29 15:26:13 +00:00
Eric Fiselier
928a58f7d2 Fix UB in uses_alloc_types.hpp
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273840 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-27 01:52:14 +00:00
Eric Fiselier
83d7ca9ea5 Implement P0163r0. Add shared_ptr::weak_type.
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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273839 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-27 01:02:43 +00:00