Commit Graph

1503 Commits

Author SHA1 Message Date
Eric Fiselier 0fdab5eb69 Implement P0392r0. Integrate filesystem::path and string_view.
llvm-svn: 276511
2016-07-23 03:10:56 +00:00
Eric Fiselier 6f4a165e51 Revert r276506 - Diagnose invalid memory order arguments in <atomic>.
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
2016-07-23 01:43:53 +00:00
Eric Fiselier 586b16e16a [libcxx] Diagnose invalid memory order arguments in <atomic>. Fixes PR21179.
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
2016-07-23 01:16:55 +00:00
Marshall Clow f067d20c6d Again, w/o the tabs
llvm-svn: 276273
2016-07-21 13:19:36 +00:00
Marshall Clow ef68f26b28 Another fix to appease the no-exception bots.
llvm-svn: 276272
2016-07-21 13:18:50 +00:00
Marshall Clow 187db16996 Fix some string_view tests that were failing when exceptions were disabled. Also comment out a _LIBCPP_ASSERT that gcc4.9 was complaining about. Will revisit that later.
llvm-svn: 276241
2016-07-21 06:24:04 +00:00
Marshall Clow 053d81ceeb Implement std::string_view as described in http://wg21.link/P0254R1. Reviewed as https://reviews.llvm.org/D21459
llvm-svn: 276238
2016-07-21 05:31:24 +00:00
Eric Fiselier 0e411641a3 Implement P0084r2. Changing emplace return types.
llvm-svn: 276230
2016-07-21 03:20:17 +00:00
Eric Fiselier 192c4f1a4a Disable warning flags when running .fail.cpp tests.
Increasingly the .fail.cpp tests are written using -verify, making them
sensitive to the exact diagnostics generated by the compiler. To prevent
additional diagnostics from being generated, and causing the tests to fail,
this patch removes the warning flags when compiling those tests.

llvm-svn: 276208
2016-07-20 23:37:28 +00:00
Eric Fiselier 7f1b098ab4 Unbreak traits tests by handling differences between version macros in clang/apple-clang.
llvm-svn: 276200
2016-07-20 22:53:21 +00:00
Eric Fiselier b2e7cc6994 Fix inheriting constructor test for std::function.
The test I originally checked in only worked with ToT Clang. This patch
updates the test so that it works as far back as 3.5.

llvm-svn: 276093
2016-07-20 06:46:22 +00:00
Eric Fiselier 85acffa676 Unbreak is_constructible tests for Clang <= 3.7.
There is a bug in Clang's __is_constructible builtin that causes it
to return true for function types; ex [T = void()].

llvm-svn: 276092
2016-07-20 06:36:11 +00:00
Eric Fiselier d5b5359802 Add missed test in r276090.
llvm-svn: 276091
2016-07-20 05:22:35 +00:00
Eric Fiselier b66b621038 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.

llvm-svn: 276084
2016-07-20 05:01:24 +00:00
Eric Fiselier 074f8d7777 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

llvm-svn: 276078
2016-07-20 02:57:39 +00:00
Eric Fiselier b11642bf94 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.

llvm-svn: 276067
2016-07-20 00:14:10 +00:00
Eric Fiselier 331d21599d Add heterogeneous comparator support for __debug_less. Fixes PR17147.
llvm-svn: 276059
2016-07-19 23:27:18 +00:00
Eric Fiselier d05b10ab4f 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

llvm-svn: 276003
2016-07-19 17:56:20 +00:00
Eric Fiselier 197228927a 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.

llvm-svn: 275772
2016-07-18 06:15:55 +00:00
Jonas Hahnfeld 16be8ee1ff [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

llvm-svn: 275760
2016-07-18 06:06:50 +00:00
Eric Fiselier a23470efe7 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.

llvm-svn: 275759
2016-07-18 06:01:50 +00:00
Eric Fiselier 826f17399b Improve ABI tests for std::pair.
llvm-svn: 275757
2016-07-18 04:48:37 +00:00
Eric Fiselier fb946da259 Add checkpoint diagnostics to help diagnose buildbot failures.
llvm-svn: 275754
2016-07-18 03:00:09 +00:00
Eric Fiselier 03f46fc2ed Prevent failures by marking Clock::is_steady tests as UNSUPPORTED: asan.
llvm-svn: 275753
2016-07-18 02:29:33 +00:00
Eric Fiselier ec0a4c9946 Add includes in test. Patch from STL@microsoft.com
llvm-svn: 275751
2016-07-18 02:05:31 +00:00
Eric Fiselier 35b6413d1b 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

llvm-svn: 275749
2016-07-18 01:58:37 +00:00
Eric Fiselier 1447da3383 Suppress warning in make_from_tuple tests.
llvm-svn: 275748
2016-07-18 01:52:46 +00:00
Eric Fiselier 03e29a2964 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.

llvm-svn: 275745
2016-07-18 00:35:56 +00:00
Eric Fiselier 649da70def Fix std::experimental::optional tests. Patch from Casey Carter.
llvm-svn: 275732
2016-07-17 20:32:30 +00:00
Marshall Clow 10e8bef1d4 Add more tests for LWG#2582. No code changes needed, just tests.
llvm-svn: 275211
2016-07-12 20:15:46 +00:00
JF Bastien 5868e5dde9 libc++: name anonymous structs
As discussed in http://reviews.llvm.org/D22073

llvm-svn: 275210
2016-07-12 20:14:52 +00:00
Marshall Clow 8001ccd06e Add tests for the meta.unary.props that do not require a complete type. This is part of LWG#2582
llvm-svn: 275184
2016-07-12 15:50:53 +00:00
Marshall Clow dc3eb83d08 Always use the allocator to construct/destruct elements of a deque/vector. Fixes PR#28412. Thanks to Jonathan Wakely for the report.
llvm-svn: 275105
2016-07-11 21:38:08 +00:00
Eric Fiselier 0774aa96dc Allow is_swappable to SFINAE on deleted/ambiguous swap functions
llvm-svn: 275094
2016-07-11 19:57:13 +00:00
Marshall Clow bc3b1f3b7b Fix typo in #ifdef; leave tests commented out b/c gcc 4.8 harks on them.
llvm-svn: 274882
2016-07-08 16:59:54 +00:00
Manman Ren 78fa242ec2 Revert r274605 due to bot failure: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/244/
llvm-svn: 274651
2016-07-06 18:24:53 +00:00
Marshall Clow 5c29783bf2 Fix typo in #ifdef, and re-enable tests now that the green-dragon bots are no more
llvm-svn: 274605
2016-07-06 05:28:44 +00:00
Eric Fiselier 4f905b8daa Handle std::get<T>(...) for std::tuple<>
llvm-svn: 274422
2016-07-02 03:46:08 +00:00
Eric Fiselier f447e62e1d Rewrite std::get<Type>(...) helper using constexpr functions.
llvm-svn: 274418
2016-07-02 03:18:30 +00:00
Eric Fiselier 27cdf401ea Cleanup SFINAE in tuple, and add tests for reference assignment
llvm-svn: 274414
2016-07-02 01:25:46 +00:00
Eric Fiselier 7b60958aea Make tuple_constructible and family lazy again.
llvm-svn: 274413
2016-07-02 00:58:17 +00:00
Eric Fiselier 58b6e3e3d0 Turn off ASAN's odr-violation diagnostics for now. See PR28391
llvm-svn: 274404
2016-07-01 23:25:47 +00:00
Eric Fiselier 10b9a1bb42 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.

llvm-svn: 274330
2016-07-01 03:54:54 +00:00
Marshall Clow 3b8669edbf Fix static assert problem on gcc; remove XFAILs that I put in in r274250
llvm-svn: 274285
2016-06-30 22:05:45 +00:00
Eric Fiselier 19cf6b6c93 Fix C++03 build.
llvm-svn: 274274
2016-06-30 20:46:58 +00:00
Marshall Clow e46c0885ff Implement LWG#2688: 'clamp misses preconditions and has extraneous condition on result'. We already did this, just added tests
llvm-svn: 274252
2016-06-30 17:52:51 +00:00
Marshall Clow bc4618647f Temporarily XFAIL the incomplete type tests for GCC while I figure out why adding a static_assert in r274235 broken them
llvm-svn: 274250
2016-06-30 17:49:36 +00:00
Marshall Clow c8afc869b0 Implement LWG#2684: 'priority_queue lacking comparator typedef'. We already did this, just added tests
llvm-svn: 274243
2016-06-30 16:03:50 +00:00
Marshall Clow 81fce9729c Implement LWG#2596: 'vector::data() should use addressof'
llvm-svn: 274241
2016-06-30 15:50:55 +00:00
Marshall Clow e766a87b01 Implement LWG#2441: 'Exact-width atomic typedefs should be provided'
llvm-svn: 274236
2016-06-30 15:28:38 +00:00