Commit Graph

1503 Commits

Author SHA1 Message Date
Eric Fiselier 43a10eb637 Don't use std::__clz in 'test/support/hexfloat.h'.
std::__clz is a libc++ specific function so it can't be used in the test suite.
This patch implements a dumb "count leading zeros" implementation within
hexfloat itself.

This patch also fixes UB since the output of `__builtin_clz(0)` is undefined
according to the GCC docs.

llvm-svn: 268354
2016-05-03 02:04:26 +00:00
Eric Fiselier 4df2666da1 Guard use of <unistd.h> in test.
llvm-svn: 268346
2016-05-03 00:36:57 +00:00
Eric Fiselier 76af416afc Cleanup warnings and remove use of __builtin_va_list in depr.c.headers
llvm-svn: 268294
2016-05-02 20:08:16 +00:00
Eric Fiselier c090b04045 Initialize local doubles to NaN. Patch from STL@microsoft.com
llvm-svn: 268285
2016-05-02 19:20:16 +00:00
Eric Fiselier fb42f4c44a Void cast runtime-unused variables. Patch from STL@microsoft.com
llvm-svn: 268284
2016-05-02 19:15:48 +00:00
Eric Fiselier 53ca3c93db Replace one more occurrence of non-standard std:launch::any. Patch from STL@microsoft.com
llvm-svn: 268153
2016-04-30 02:30:18 +00:00
Eric Fiselier 3ed9f6ebde Fix PR21428 for long. Buffer was one byte too small in octal formatting case. Rename previously added test
llvm-svn: 268009
2016-04-29 07:23:20 +00:00
Eric Fiselier cc06271d12 Move extern C include test into test/libcxx
llvm-svn: 267983
2016-04-29 04:19:48 +00:00
Eric Fiselier cbeadbdbad Fix test failures by adding missing include
llvm-svn: 267982
2016-04-29 04:18:13 +00:00
Eric Fiselier 382e91792b Fix or move various non-standard tests.
This patch does the following:

* Remove <__config> includes from some container tests.
* Guards uses of std::launch::any in async tests because it's an extension.
* Move "test/std/extensions" to "test/libcxx/extensions"
* Moves various non-standard tests including those in "sequences/vector",
  "std/localization" and "utilities/meta".

llvm-svn: 267981
2016-04-29 04:07:45 +00:00
Eric Fiselier bc32b5cf8f Move INVOKE tests into test/libcxx sub-tree.
Testing the concrete implementation of INVOKE means calling the implementation
specific names `__invoke` and `__invoke_constexpr`. For this reason the test
are non-standard. For this reason it's best if the tests live outside of the
`test/std` directory.

llvm-svn: 267973
2016-04-29 01:52:57 +00:00
Eric Fiselier 23323e25f8 Fix possible test breakage for MinGW
llvm-svn: 267968
2016-04-29 01:22:16 +00:00
Eric Fiselier 903f1ab93a Fix get_temp_file_name() to compile on Windows. Patch from STL@microsoft.com
llvm-svn: 267963
2016-04-29 00:51:24 +00:00
Eric Fiselier a643eb7ec0 Remove more names of unreferenced parameters. Patch from STL@microsoft.com
llvm-svn: 267962
2016-04-29 00:47:16 +00:00
Eric Fiselier 6abce62b4e Add a return value for nasty_mutex::operator&. Patch from STL@microsoft.com
llvm-svn: 267961
2016-04-29 00:45:46 +00:00
Eric Fiselier 6c5edd1263 Add <string> include for streaming operators. Patch from STL@microsoft.com
llvm-svn: 267959
2016-04-29 00:39:40 +00:00
Eric Fiselier 7d7d2c0edd Add proper include for unique_ptr. Patch from STL@microsoft.com
llvm-svn: 267958
2016-04-29 00:37:56 +00:00
Eric Fiselier 1f4231f8cf Guard libc++ specific c.__invariants() tests in LIBCPP_ASSERT macros
llvm-svn: 267947
2016-04-28 22:28:23 +00:00
Eric Fiselier 7626f778a5 Remove names of unreferenced parameters. Patch from STL@microsoft.com
llvm-svn: 267852
2016-04-28 03:17:56 +00:00
Eric Fiselier 0d62791983 Add braces, move braces, and rename variables to avoid shadowing. Patch from STL@microsoft.com
llvm-svn: 267844
2016-04-28 02:45:11 +00:00
Eric Fiselier 0f9e91acc8 Provide member function definitions to avoid warnings. Patch from STL@microsoft.com
llvm-svn: 267843
2016-04-28 02:18:48 +00:00
Eric Fiselier 588e1dbda2 Rename function parameters to avoid shadowing. Patch from STL@microsoft.com
llvm-svn: 267838
2016-04-28 02:00:52 +00:00
Eric Fiselier e5eb7049eb Guard Clang and GCC specific pragmas. Patch from STL@microsoft.com
llvm-svn: 267836
2016-04-28 01:49:03 +00:00
Marshall Clow 91929f643e Fix = that should have been == in test. Thanks to STL@microsoft for the catch
llvm-svn: 267654
2016-04-27 01:46:43 +00:00
Marshall Clow 8dc9dcaeac Apparently XFAIL tests that are supposed to fail to compile can be problematic. They still get compiled, and if the compile succeeds, the buildbots complain. Replace the XFAIL with #error.
llvm-svn: 267591
2016-04-26 19:29:35 +00:00
Marshall Clow fd5ceb2228 #include <test_macros.h> in all the regex tests, and remove all mentions of __cpluplus (use TEST_STD_VERS and/or XFAIL instead). No functional change
llvm-svn: 267567
2016-04-26 16:24:44 +00:00
Marshall Clow a64a8fc969 Rename a few tests that had typos in their names. No functional change. Thanks to STL for the catch
llvm-svn: 267287
2016-04-23 14:31:00 +00:00
Eric Fiselier b530a2591b Fix some non-standard parts of our test suite. Reported by STL
llvm-svn: 267131
2016-04-22 10:33:56 +00:00
Marshall Clow f8997cf5ae Add missing include of <algorithm>
llvm-svn: 267119
2016-04-22 07:39:05 +00:00
Eric Fiselier 906c50859b Fix LWG issue #2106: move_iterators returning prvalues
llvm-svn: 267091
2016-04-22 00:49:12 +00:00
Eric Fiselier b7f045fc7d Fix C++03 build breakage
llvm-svn: 267090
2016-04-22 00:47:15 +00:00
Eric Fiselier d513ad88d5 Complete LWG issue #2016. Allocators must be nothrow swappable
llvm-svn: 267085
2016-04-22 00:15:18 +00:00
Eric Fiselier f07dd8d0a9 Add is_swappable/is_nothrow_swappable traits
llvm-svn: 267079
2016-04-21 23:38:59 +00:00
Eric Fiselier f40dd3278e Add cxx_runtime_root options for testing against a different libc++ at runtime
llvm-svn: 266855
2016-04-20 04:17:39 +00:00
Eric Fiselier e08afaf8df [libcxx] Fix PR15638 - Only allocate in parent when starting a thread to 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
2016-04-20 02:21:33 +00:00
Eric Fiselier 840fa745ca Add 'is_callable' and 'is_nothrow_callable' traits and cleanup INVOKE.
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
2016-04-20 00:14:32 +00:00
Ben Craig e83514a546 XFAILing new test on C++03
initializer_list doesn't exist in C++03.

llvm-svn: 266820
2016-04-19 21:07:30 +00:00
Ben Craig 8743f8ca24 Include initializer_list from utility
The C++11 and C++14 standards both say in the header <utility> synopsis that
<utility> shall include <initializer_list>.

llvm-svn: 266808
2016-04-19 20:13:55 +00:00
Ben Craig 0142a9da81 Framework to allow testing of static libc++abi
These changes make linking against static libraries more explicit. Instead
of using -lc++ and -lc++abi in the tests, an absolute path to the library is
provided instead.

The choices of shared vs. static, and the choices of library paths for both
libcxx and libcxxabi needed to be exchanged for this to work. In other words,
libcxx tests need to know the library path of libcxxabi, and whether libcxxabi
is a static or shared library.

Some Mac specific logic for testing against libc++abi had to be moved from
libcxxabi's config.py, as it was overriding choices made in libcxx's config.py.
That logic is now in libcxx's target_info.py.

Testing a static libcxx on Linux will now automatically link in librt most of
the time. Previously, lots of pthread tests would fail because of an
unresolved clock_gettime.

http://reviews.llvm.org/D16544

llvm-svn: 266730
2016-04-19 12:49:05 +00:00
Eric Fiselier 9795699a72 Make tuples constructors conditionally EXPLICIT. See N4387
llvm-svn: 266703
2016-04-19 01:19:25 +00:00
Eric Fiselier 2152fd7682 Implement LWG issue 2219 - support reference_wrapper in INVOKE
llvm-svn: 266590
2016-04-18 06:17:30 +00:00
Eric Fiselier df691e18f3 Add hash specializations for __int128_t. Fixes LWG issue 2119
llvm-svn: 266587
2016-04-18 02:54:00 +00:00
Eric Fiselier 40fde4d33e Add tests for LWG issue 2361
llvm-svn: 266586
2016-04-18 02:31:05 +00:00
Eric Fiselier 7a9f500fcb Fix LWG issue 2345 - Add insert(value_type&&)
llvm-svn: 266585
2016-04-18 01:40:45 +00:00
Eric Fiselier 500886841d Teach map/unordered_map how to optimize 'emplace(Key, T)'.
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
2016-04-16 00:23:12 +00:00
Eric Fiselier fa1f613f7e Extract key to avoid preemptive mallocs in insert/emplace in associative 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
2016-04-15 23:27:27 +00:00
Eric Fiselier 74cba6427a Cleanup and guard tuple's constructor SFINAE. Fixes PR22806 and PR23256.
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
2016-04-15 18:05:59 +00:00
Eric Fiselier 90fb2baff7 [libcxx] Remove the "reduced-arity-initialization" extension from the 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
2016-04-15 03:29:40 +00:00
Marshall Clow 05333fc8af Implement LWG#680, which was missed lo these many moons ago, and was 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
2016-04-11 03:54:53 +00:00
Marshall Clow 89685ed0da Recommit r263036 with additional inlining, so that it will continue to work with existing system dylibs. Implements LWG#2583
llvm-svn: 265706
2016-04-07 18:13:41 +00:00
Marshall Clow f90ec0e82e Added a noexcept test
llvm-svn: 265674
2016-04-07 14:24:16 +00:00
Marshall Clow 0ab4205705 Fix bug #27260 - add missing swap(reference, reference) to vector<bool>.
llvm-svn: 265672
2016-04-07 14:20:31 +00:00
Eric Fiselier 54f0cda625 Fix LWG issue 2469 - Use piecewise construction in map::operator[].
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
2016-03-31 03:13:37 +00:00
Eric Fiselier 5e3ea4dd79 Teach __tree how to handle map's __value_type
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
2016-03-31 02:15:15 +00:00
Eric Fiselier 8a0313d4b6 Update container_test_types.h and cleanup the related tests
llvm-svn: 264985
2016-03-31 02:13:14 +00:00
JF Bastien b95ee819f2 Implement is_always_lock_free
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
2016-03-25 15:48:21 +00:00
Richard Barton 3c0bc9697a Guard a number of tests relying on threads support when built in
single-threaded mode.

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

llvm-svn: 264191
2016-03-23 21:04:11 +00:00
JF Bastien 5b5061f0ca Missing ATOMIC_*_LOCK_FREE tests
Forked from D17951, these tests should have been there but weren't.

llvm-svn: 263798
2016-03-18 17:48:58 +00:00
Duncan P. N. Exon Smith fde79b40c2 unord: Extract key to avoid preemptive mallocs in insert/emplace
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
2016-03-17 20:45:20 +00:00
Eric Fiselier a58d430cac Make std::addressof constexpr in C++17 (Clang only).
llvm-svn: 263688
2016-03-17 03:30:56 +00:00
Eric Fiselier 7865b2e943 Add clang thread safety annotations to mutex and lock_guard. Patch by 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
2016-03-16 02:30:06 +00:00
Jonas Hahnfeld 83bedca7e9 [libcxx] Remove localization tests for Russian month names
Commit f49839299a085505eb673544744b61d2d9cdd1db in glibc-2.14 changed the
locales to the currently required format. However, they were again changed in
commit 55bdd2866f23b28422d969060b3518909a12b100 which has been released in 2.17.

That leads to the current situation where Debian and e.g. CentOS 6 have the
pre-2.14 locales, for example Ubuntu 14.04 has pre-2.17 and CentOS 7 on the
other hand has the newest locales in glibc-2.17.

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

llvm-svn: 263554
2016-03-15 15:55:58 +00:00
Marshall Clow 6257b93e69 Missed this file in previous checkin
llvm-svn: 263507
2016-03-14 23:07:58 +00:00
Marshall Clow 0b54e792b7 Implement LWG2577: {shared,unique}_lock</tt> should use std::addressof
llvm-svn: 263506
2016-03-14 23:07:32 +00:00
Marshall Clow bb9f50014c Add failing tests that I forgot to add to the last commit
llvm-svn: 263451
2016-03-14 17:58:54 +00:00
Marshall Clow c1fe2c4329 Implement LWG#2566: Requirements on the first template parameter of container adaptors
llvm-svn: 263450
2016-03-14 17:58:11 +00:00
Marshall Clow 4251d3779f Mark exception-throwing test as XFAIL when exceptions are disabled
llvm-svn: 263405
2016-03-14 02:51:50 +00:00
Nico Weber 47c3a4743e Revert r263036, it's ABI-breaking.
llvm-svn: 263246
2016-03-11 15:26:06 +00:00
Marshall Clow ffc888bc09 Implement LWG#2579: Inconsistency wrt Allocators in basic_string assignment vs. basic_string::assign
llvm-svn: 263042
2016-03-09 18:08:29 +00:00
Marshall Clow e96f8b52d9 Implement LWG#2583: There is no way to supply an allocator for basic_string(str, pos)
llvm-svn: 263036
2016-03-09 17:51:43 +00:00
Marshall Clow 1b868e19c3 Add some more tests for the containers type requirements
llvm-svn: 263029
2016-03-09 17:19:07 +00:00
Marshall Clow 49738fe10b Remove a couple tabs that crept in
llvm-svn: 262932
2016-03-08 15:45:06 +00:00
Marshall Clow dd1729fe8a Implement P0272R1: Give 'std::string' a non-const '.data()' member function
llvm-svn: 262931
2016-03-08 15:44:30 +00:00
Marshall Clow 28cc4dde49 Implement P0253R1: Fixing a design mistake in the searchers interface.
llvm-svn: 262928
2016-03-08 15:12:52 +00:00
Marshall Clow 146c14ac33 Implement P0025R0: 'An algorithm to clamp a value between a pair of boundary values' for C++17
llvm-svn: 262871
2016-03-07 22:43:49 +00:00
Marshall Clow ee66eb1328 non-member swap for array was mistakenly taking const ref params. Fixed and added test. Thanks to Ben Craig for the catch
llvm-svn: 262866
2016-03-07 21:57:10 +00:00
Marshall Clow 4cec709ed6 Fix for PR26812: possible overflow issue in std::allocator::allocate
llvm-svn: 262610
2016-03-03 12:04:39 +00:00
Marshall Clow 4877c197c2 Added tests to make sure that the categorization traits work on incomplete types
llvm-svn: 261925
2016-02-25 20:15:47 +00:00
Marshall Clow 71abfc1392 No, really - test the constructor
llvm-svn: 261875
2016-02-25 15:27:13 +00:00
Marshall Clow 6433044dc9 Add test to ensure that the converting constructor in N4089 is present and working
llvm-svn: 261874
2016-02-25 15:25:29 +00:00
Marshall Clow 1b9fae5a40 These new tests fail on the green-dragon bots, which use an old Apple compiler.
Since they're scheduled to be updated soon, we'll just comment out this test for
the moment, and re-commit when the bots are updated.

llvm-svn: 261661
2016-02-23 18:09:38 +00:00
Marshall Clow 9bb3582fc9 Add tests for LWG#2560. No code changes, just tests
llvm-svn: 261653
2016-02-23 17:01:52 +00:00
Marshall Clow 9fe1e550c8 Add additional tests to ensure that we DTRT with short lists. This is LWG#2590, but there are no code changes, just additional tests
llvm-svn: 261648
2016-02-23 16:25:20 +00:00
Marshall Clow 9b4880e7ec Fix __is_referenceable to work with vector types. Fixes PR#26654 and 26656. Thanks to Evgeniy for the reports, and to Eric for the suggestion on how to fix it.
llvm-svn: 261581
2016-02-22 22:13:03 +00:00
Eric Fiselier 43b121df05 Rename <__hash_table> traits so they don't conflict with similar traits.
In particular <__tree> defines many of the same types of traits classes.

llvm-svn: 261421
2016-02-20 07:59:16 +00:00
Eric Fiselier 0594ad713b Remove all usages of "const" node pointer typedefs in the assoc containers.
The "const" pointer typedefs such as "__node_const_pointer" and
"__node_base_const_pointer" are identical to their non-const pointer types.
This patch changes all usages of "const" pointer type names to their respective
non-const typedef.

Since "fancy pointers to const" cannot be converted back to a non-const pointer
type according to the allocator requirements it is important that we never
actually use "const" pointers.

Furthermore since "__node_const_pointer" and "__node_pointer" already
name the same type, it's very confusing to use both names. Especially
when defining const/non-const overloads for member functions.

llvm-svn: 261419
2016-02-20 07:12:17 +00:00
Eric Fiselier 089a7cc5de Cleanup node-type handling in the associative containers.
This patch is very similar to r260431.

This patch is the first in a series of patches that's meant to better
support map. map has a special "value_type" that
differs from pair<const Key, Value>. In order to meet the EmplaceConstructible
and CopyInsertable requirements we need to teach __tree about this
special value_type.

This patch creates a "__tree_node_types" traits class that contains
all of the typedefs needed by the associative containers and their iterators.
These typedefs include ones for each node type and  node pointer type,
as well as special typedefs for "map"'s value type.

Although the associative containers already supported incomplete types, this
patch makes it official by adding tests.

This patch will be followed up shortly with various cleanups within __tree and
fixes for various map bugs and problems.

llvm-svn: 261416
2016-02-20 05:28:30 +00:00
Eric Fiselier 3d8a30a9db Work around GCC bug in .fail.cpp tests
llvm-svn: 261391
2016-02-20 01:11:55 +00:00
Eric Fiselier c4ac8bd051 Commit tests missing from r261180.
llvm-svn: 261181
2016-02-18 00:21:09 +00:00
Eric Fiselier 0f90567744 Fix LWG issue 2469 - Use piecewise construction in unordered_map::operator[].
unordered_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'.

llvm-svn: 260601
2016-02-11 21:45:53 +00:00
Eric Fiselier 614ed76c37 Revert r260514 because it has a bogus commit message.
llvm-svn: 260556
2016-02-11 18:21:18 +00:00
Marshall Clow 9b66ab75fd Add some tests to ensure that the __regex_word does not conflict with any of ctype_base's values.
Hopefully this will catch cases like https://llvm.org/bugs/show_bug.cgi?id=26476 in the future.

llvm-svn: 260527
2016-02-11 15:23:04 +00:00
Eric Fiselier daed67fffe separate nested >>
llvm-svn: 260516
2016-02-11 12:51:19 +00:00
Vasileios Kalintiris d247ac44cc Re-commit "Introduce a cmake module to figure out whether we need to link with libatomic."
This re-applies commit r260235. However, this time we add -gcc-toolchain
to the compiler's flags when the user has specified the LIBCXX_GCC_TOOLCHAIN
variable.

llvm-svn: 260515
2016-02-11 12:43:04 +00:00
Eric Fiselier 45c4d45ead Teach __hash_table how to handle unordered_map's __hash_value_type.
This patch is fairly large and contains a number of changes. The main change
is teaching '__hash_table' how to handle '__hash_value_type'. Unfortunately
this change is a rampant layering violation, but it's required to make
unordered_map conforming without re-writing all of __hash_table.
After this change 'unordered_map' can delegate to '__hash_table' in almost all cases.

The major changes found in this patch are:

  * Teach __hash_table to differentiate between the true container value type
    and the node value type by introducing the "__container_value_type" and
    "__node_value_type" typedefs. In the case of unordered_map '__container_value_type'
    is 'pair<const Key, Value>' and '__node_value_type' is '__hash_value_type'.
    
  * Switch almost all overloads in '__hash_table' previously taking 'value_type'
    (AKA '__node_value_type) to take  '__container_value_type' instead. Previously
    'pair<K, V>' would be implicitly converted to '__hash_value_type<K, V>' because
    of the function signature.
    
  * Add '__get_key', '__get_value', '__get_ptr', and '__move' static functions to
    '__key_value_types'. These functions allow '__hash_table' to unwrap
    '__node_value_type' objects into '__container_value_type' and its sub-parts.

  * Pass  '__hash_value_type::__value_'  to 'a.construct(p, ...)' instead of
    '__hash_value_type' itself. The C++14 standard requires that 'a.construct()'
    and 'a.destroy()' are only ever instantiated for the containers value type.

  * Remove '__hash_value_type's constructors and destructors. We should never
    construct an instance of this type.
    (TODO this is UB but we already do it in plenty of places).
  
  * Add a generic "try-emplace" function to '__hash_table' called
    '__emplace_unique_key_args(Key const&, Args...)'.

  
The following changes were done as cleanup:

  * Introduce the '_LIBCPP_CXX03_LANG' macro to be used in place of
    '_LIBCPP_HAS_NO_VARIADICS' or '_LIBCPP_HAS_NO_RVALUE_REFERENCE'.
    
  * Cleanup C++11 only overloads that assume an incomplete C++11 implementation.
    For example this patch removes the __construct_node overloads that do
    manual pack expansion.
    
  * Forward 'unordered_map::emplace' to '__hash_table' and remove dead code
    resulting from the change. This includes almost all
    'unordered_map::__construct_node' overloads.


The following changes are planed for future revisions:

  * Fix LWG issue #2469 by delegating 'unordered_map::operator[]' to use
    '__emplace_unique_key_args'.
    
  * Rewrite 'unordered_map::try_emplace' in terms of '__emplace_unique_key_args'.
  
  * Optimize '__emplace_unique' to call '__emplace_unique_key_args' when possible.
    This prevent unneeded allocations when inserting duplicate entries.


The additional follow up work needed after this patch:

  * Respect the lifetime rules for '__hash_value_type' by actually constructing it.
  * Make '__insert_multi' act similar to '__insert_unique' for objects of type
    'T&' and 'T const &&' with 'T = __container_value_type'.
  
  

llvm-svn: 260514
2016-02-11 12:25:27 +00:00
Eric Fiselier fcd0221118 Teach __hash_table how to handle unordered_map's __hash_value_type.
This patch is fairly large and contains a number of changes. The main change
is teaching '__hash_table' how to handle '__hash_value_type'. Unfortunately
this change is a rampant layering violation, but it's required to make
unordered_map conforming without re-writing all of __hash_table.
After this change 'unordered_map' can delegate to '__hash_table' in almost all cases.

The major changes found in this patch are:

  * Teach __hash_table to differentiate between the true container value type
    and the node value type by introducing the "__container_value_type" and
    "__node_value_type" typedefs. In the case of unordered_map '__container_value_type'
    is 'pair<const Key, Value>' and '__node_value_type' is '__hash_value_type'.
    
  * Switch almost all overloads in '__hash_table' previously taking 'value_type'
    (AKA '__node_value_type) to take  '__container_value_type' instead. Previously
    'pair<K, V>' would be implicitly converted to '__hash_value_type<K, V>' because
    of the function signature.
    
  * Add '__get_key', '__get_value', '__get_ptr', and '__move' static functions to
    '__key_value_types'. These functions allow '__hash_table' to unwrap
    '__node_value_type' objects into '__container_value_type' and its sub-parts.

  * Pass  '__hash_value_type::__value_'  to 'a.construct(p, ...)' instead of
    '__hash_value_type' itself. The C++14 standard requires that 'a.construct()'
    and 'a.destroy()' are only ever instantiated for the containers value type.

  * Remove '__hash_value_type's constructors and destructors. We should never
    construct an instance of this type.
    (TODO this is UB but we already do it in plenty of places).
  
  * Add a generic "try-emplace" function to '__hash_table' called
    '__emplace_unique_key_args(Key const&, Args...)'.

  
The following changes were done as cleanup:

  * Introduce the '_LIBCPP_CXX03_LANG' macro to be used in place of
    '_LIBCPP_HAS_NO_VARIADICS' or '_LIBCPP_HAS_NO_RVALUE_REFERENCE'.
    
  * Cleanup C++11 only overloads that assume an incomplete C++11 implementation.
    For example this patch removes the __construct_node overloads that do
    manual pack expansion.
    
  * Forward 'unordered_map::emplace' to '__hash_table' and remove dead code
    resulting from the change. This includes almost all
    'unordered_map::__construct_node' overloads.


The following changes are planed for future revisions:

  * Fix LWG issue #2469 by delegating 'unordered_map::operator[]' to use
    '__emplace_unique_key_args'.
    
  * Rewrite 'unordered_map::try_emplace' in terms of '__emplace_unique_key_args'.
  
  * Optimize '__emplace_unique' to call '__emplace_unique_key_args' when possible.
    This prevent unneeded allocations when inserting duplicate entries.


The additional follow up work needed after this patch:

  * Respect the lifetime rules for '__hash_value_type' by actually constructing it.
  * Make '__insert_multi' act similar to '__insert_unique' for objects of type
    'T&' and 'T const &&' with 'T = __container_value_type'.
  
  

llvm-svn: 260513
2016-02-11 11:59:44 +00:00
Eric Fiselier 75d0dcfde7 Recommit r260012 - Cleanup node-type handling in the unordered containers.
This time I kept <ext/hash_map> working!

This patch is the first in a series of patches that's meant to better
support unordered_map. unordered_map has a special "value_type" that
differs from pair<const Key, Value>. In order to meet the EmplaceConstructible
and CopyInsertable requirements we need to teach __hash_table about this
special value_type.

This patch creates a "__hash_node_types" traits class that contains
all of the typedefs needed by the unordered containers and it's iterators.
These typedefs include ones for each node type and  node pointer type,
as well as special typedefs for "unordered_map"'s value type.

As a result of this change all of the unordered containers now all support
incomplete types.

As a drive-by fix I changed the difference_type in __hash_table to always
be ptrdiff_t. There is a corresponding change to size_type but it cannot
take affect until an ABI break.

This patch will be followed up shortly with fixes for various unordered_map
bugs and problems.

llvm-svn: 260431
2016-02-10 20:46:23 +00:00
Richard Smith 5fd17ab1b0 Fix overload sets of strchr, strpbrk, strrchr, memchr and strstr from
<string.h> and wcschr, wcspbrk, wcsrchr, wmemchr, and wcsstr from <wchar.h> to
provide a const-correct overload set even when the underlying C library does
not.

This change adds a new macro, _LIBCPP_PREFERRED_OVERLOAD, which (if defined)
specifies that a given overload is a better match than an otherwise equally
good function declaration without the overload. This is implemented in modern
versions of Clang via __attribute__((enable_if)), and not elsewhere.

We use this new macro to define overloads in the global namespace for these
functions that displace the overloads provided by the C library, unless we
believe the C library is already providing the correct signatures.

llvm-svn: 260337
2016-02-10 00:59:02 +00:00
Vasileios Kalintiris 7432c0472d Revert "Introduce a cmake module to figure out whether we need to link with libatomic."
This reverts commit r260235. It breaks LLVM's bootstrap when building
with a -gcc-toolchain and the system's gcc installation does not provide
the libatomic library and its headers. We should check whether
LIBCXX_GCC_TOOLCHAIN is set and adjust the flags accordingly.

llvm-svn: 260323
2016-02-09 23:38:28 +00:00
Vasileios Kalintiris cca79b8700 Introduce a cmake module to figure out whether we need to link with libatomic.
Summary:
This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
8-byte atomic operations call into the libatomic library.

Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg

Subscribers: cfe-commits

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

llvm-svn: 260235
2016-02-09 17:00:38 +00:00
Marshall Clow a0cd4374d8 Minor updates to failing tests. NFC
llvm-svn: 260202
2016-02-09 06:38:56 +00:00
Eric Fiselier 20af59e38c Revert r260012 due to __gnu_cxx::hash_map breakage
llvm-svn: 260172
2016-02-08 23:47:13 +00:00
Marshall Clow d77ed5a1a9 Clean up a test; get rid of hard-wired char/wchar_t code for template fns that take any char type. Prep work for PR#26503
llvm-svn: 260115
2016-02-08 17:38:23 +00:00
Eric Fiselier 1b2e4ffa58 Cleanup node-type handling in the unordered containers
This patch is the first in a series of patches that's meant to better
support unordered_map. unordered_map has a special "value_type" that
differs from pair<const Key, Value>. In order to meet the EmplaceConstructible
and CopyInsertable requirements we need to teach __hash_table about this
special value_type.

This patch creates a "__hash_node_types" traits class that contains
all of the typedefs needed by the unordered containers and it's iterators.
These typedefs include ones for each node type and  node pointer type,
as well as special typedefs for "unordered_map"'s value type.

As a result of this change all of the unordered containers now all support
incomplete types.

As a drive-by fix I changed the difference_type in __hash_table to always
be ptrdiff_t. There is a corresponding change to size_type but it cannot
take affect until an ABI break.

This patch will be followed up shortly with fixes for various unordered_map
fixes.

llvm-svn: 260012
2016-02-07 00:36:33 +00:00
Duncan P. N. Exon Smith f42ef3efca re.results.form: Format out-of-range subexpression references as null
Rather than crashing in match_results::format() when a reference to a
marked subexpression is out of range, format the subexpression as empty
(i.e., replace it with an empty string).  Note that
match_results::operator[]() has a range-check and returns a null match
in this case, so this just re-uses that logic.

llvm-svn: 259682
2016-02-03 19:30:20 +00:00
Daniel Sanders ea59b9d91f [libcxx] Work around for clang calling GAS after having already failed.
Summary:
This is a workaround to a clang bug which causes libcxx tests to fail in the 3.8
release. The clang bug is currently being investigated. It seems that clang
does not stop after frontend errors when using -verify and -fno-integrated-as
(or when this is the default). This patch adds -fsyntax-only to prevent GAS
from being called, fixing the libcxx failures.

PR26277

Patch by Eric Fiselier

Reviewers: mclow.lists, hans, EricWF

Subscribers: cfe-commits

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

llvm-svn: 259046
2016-01-28 13:49:33 +00:00
Marshall Clow e046bbdded implement ostream_joiner. Reviewed as http://reviews.llvm.org/D16605
llvm-svn: 259014
2016-01-28 04:14:56 +00:00
Daniel Sanders 90c86ea5f1 [libcxx] Additional 'REQUIRE' directives for tests that require en_US.UTF-8.
Summary:
These are the tests that didn't fail in the release candidate because they were
covered by another 'REQUIRES' directive.

Reviewers: mclow.lists, hans, bcraig, EricWF

Subscribers: EricWF, dim, cfe-commits

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

llvm-svn: 258920
2016-01-27 10:45:07 +00:00
Eric Fiselier 07b9cd36fa [libcxx] Fix undefined behavior in forward_list
Summary:
This patch is similar to the <list> fix but it has a few differences. This patch doesn't use a `__link_pointer` typedef because we don't need to change the linked list pointers because `forward_list` never stores a  `__forward_begin_node` in the linked list itself. 

The issue with `forward_list` is that the iterators store pointers to `__forward_list_node` and not `__forward_begin_node`. This is incorrect because `before_begin()` and `cbefore_begin()` return iterators that point to a `__forward_begin_node`. This means we incorrectly downcast the `__forward_begin_node` pointer to a `__node_pointer`. This downcast itself is sometimes UB but it cannot be safely removed until ABI v2. The more common cause of UB is when we deference the downcast pointer. (for example `__ptr_->__next_`). This can be fixed without an ABI break by upcasting `__ptr_` before accessing it.

The fix is as follows:

1. Introduce a `__iter_node_pointer` typedef that works  similar to `__link_pointer` in the last patch. In ABI v2 it is always a typedef for `__begin_node_pointer`.
2. Change the `__before_begin()` method to return the correct pointer type (`__begin_node_pointer`),
    Previously it incorrectly downcasted  the  `__forward_begin_node` to a `__node_pointer`  so it could be used to constructor the iterator types.
3. Change `__forward_list_iterator` and `__forward_list_const_iterator`  in the following way:
    1. Change `__node_pointer __ptr_;` member to  have the `__iter_node_pointer` type instead. 
    2. Add additional private constructors that accept `__begin_node_pointer` in addition to `__node_pointer` and then correctly cast them to the stored `__iter_node_pointer` type. 
    3. Add  `__get_begin()` and `__get_node_unchecked()` accessor methods that correctly cast `__ptr_` to the expected pointer type. `__get_begin()` is always safe to use and should be 
       preferred. `__get_node_unchecked()` can only be used on a deferencible iterator.
4. Replace direct access to `__forward_list_iterator::__ptr_`  with the safe accessor methods.
  


Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 258888
2016-01-27 00:11:54 +00:00
Eric Fiselier 060cc200d0 Fix PR26103 - Error calling is_convertible with incomplete type. Patch from Michael Daniels.
llvm-svn: 258852
2016-01-26 20:24:30 +00:00
Marshall Clow 0aa1ccb0d9 Implement LWG#2385; remove the allocator-aware std::function::assign call. It was useless, and didn't actually *do anything* with the allocator. Now it's gone. On the off chance that someone is mistakenly calling it, it's only gone in C++1z
llvm-svn: 258697
2016-01-25 17:29:55 +00:00
Marshall Clow c38568f660 Fix test to pass in C++03
llvm-svn: 258593
2016-01-23 01:02:29 +00:00
Marshall Clow fcdb19904c Implement LWG#2101 'Some transformation types can produce impossible types' Introduced a new (internal) type trait '__is_referenceable' with tests. Use that trait in add_lvalue_reference, add_rvalue_reference and add_pointer.
llvm-svn: 258418
2016-01-21 18:22:43 +00:00
Daniel Sanders 61c115f32c [libcxx] Add appropriate 'REQUIRE' directives to tests that require en_US.UTF-8.
Reviewers: mclow.lists, hans

Subscribers: bcraig, cfe-commits

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

llvm-svn: 258403
2016-01-21 15:35:15 +00:00
Eric Fiselier 48c3483f45 Use TEST_STD_VER instead of __has_feature to detect noexcept. This fixes the test with GCC.
llvm-svn: 258292
2016-01-20 05:44:11 +00:00
Marshall Clow e612a8877a More string fixes for noexcept cases. Apparently I didn't get them all in r258281.
llvm-svn: 258291
2016-01-20 05:41:24 +00:00
Eric Fiselier 6469c3ec17 Mark some test XFAIL for GCC 4.9 due to missing is_trivial* traits
llvm-svn: 258287
2016-01-20 04:59:57 +00:00
Marshall Clow 64ca6868f5 Got the test backwards in r258279. Fixed that and de-tabbed
llvm-svn: 258281
2016-01-20 03:37:46 +00:00
Marshall Clow 9d10d27c67 Fix up the tests I added for string exceptions to be skipped when exceptions are disabled
llvm-svn: 258279
2016-01-20 03:19:15 +00:00
Eric Fiselier c467208791 Fix enviroment variables when running shell scripts
llvm-svn: 258217
2016-01-19 23:06:29 +00:00
Eric Fiselier 38236b5750 Add missing license headers
llvm-svn: 258196
2016-01-19 21:52:04 +00:00
Eric Fiselier 8132bdc8e1 Mark slow ASAN/MSAN tests as XFAIL for now.
llvm-svn: 258195
2016-01-19 21:51:07 +00:00
Marshall Clow b414b2f54b Fix PR#26175. Thanks to Josh Petrie for the report and the patch. Reviewed as http://reviews.llvm.org/D16262
llvm-svn: 258107
2016-01-19 00:50:37 +00:00
Marshall Clow a015d39239 Better comments in test. NFC
llvm-svn: 257702
2016-01-13 23:05:15 +00:00
Marshall Clow 3dd0ff3b62 Fix test for C++03 - lacking noexcept
llvm-svn: 257696
2016-01-13 22:52:36 +00:00
Marshall Clow 76b4afc040 Fix PR#25973 : 'basic_string::assign(InputIt, InputIt) doesn't provide the strong exception safety guarantee'. This turned out to be a pervasive problem in <string>, which required a fair amount of rework. Add in an optimization for when iterators provide noexcept increment/comparison/assignment/dereference (which covers many of the iterators in libc++). Reviewed as http://reviews.llvm.org/D15862
llvm-svn: 257682
2016-01-13 21:54:34 +00:00
Dan Gohman 4a9e173e08 [WebAssembly] Set std::numeric_limits's traps field for WebAssembly.
WebAssembly's integer division instruction traps on division by zero; set the
traps field of integral std::numeric_limits to true.

llvm-svn: 257612
2016-01-13 16:32:00 +00:00
Marshall Clow df5ddf2c7a One more missing std:: qualification from Jonathan
llvm-svn: 257506
2016-01-12 19:15:10 +00:00
Marshall Clow 8d113d430f Add a bunch of missing includes in the test suite to make it more portable. Fixes bugs #26120 and #26121. Thanks to Jonathan Wakely for the reports and the patches.
llvm-svn: 257474
2016-01-12 14:51:04 +00:00
Ahmed Bougacha 812d65a26a [libcxx] Set LC_ALL rather than LC_COLLATE to override collation.
r251131 replaced LANG with LC_COLLATE. But LC_ALL has precedence
over both, so the test still fails when LC_ALL=C.

llvm-svn: 257018
2016-01-07 02:36:09 +00:00
Marshall Clow 652a2ce191 Add explicit include directives; the file was getting implicitly included already. NFC
llvm-svn: 256864
2016-01-05 19:53:31 +00:00
Marshall Clow fd495892d6 Remove some test scaffolding that I added and then didn't need. No functional change
llvm-svn: 256861
2016-01-05 19:44:58 +00:00
Marshall Clow afc9ff99ec First half of LWG#2354: 'Unnecessary copying when inserting into maps with braced-init syntax'
llvm-svn: 256859
2016-01-05 19:32:41 +00:00
Ahmed Bougacha 4d315f1300 [libcxx] Fix typo in darwin target_info.py introduced by r256621.
llvm-svn: 256772
2016-01-04 19:35:40 +00:00
Eric Fiselier 67ac709e4c Print stacktrace with UBSAN
llvm-svn: 256729
2016-01-04 03:54:58 +00:00
Eric Fiselier d57bcda1cb Fix locale feature testing in test suite.
llvm-svn: 256621
2015-12-30 04:45:42 +00:00
Eric Fiselier 7481ac43a5 Fix test failure in 32 bit mode
llvm-svn: 256598
2015-12-29 23:19:00 +00:00
Ben Craig d38f60270c [libcxx] Fixing the Mac / Darwin build
llvm-svn: 256594
2015-12-29 23:01:07 +00:00
Ben Craig 8de2f0cf01 [libcxx] Fixing silly mistake from last commit.
Tested on Linux x86_64 targeting Linux x86_64.

llvm-svn: 256592
2015-12-29 22:55:55 +00:00
Ben Craig e238372258 [libcxx] Fixing the Linux sanitizer builds
llvm-svn: 256591
2015-12-29 22:43:17 +00:00
Ben Craig 90bee6354d [libcxx] Refactoring target_info.py
This patch makes it easier to support running the lit tests for new and
unusual platforms. It will break existing users that set
LIBCXX_TARGET_INFO to anything other than the default. I think this is
fine, because the old LIBCXX_TARGET_INFO wasn't terribly useful.

The old way of supporting the different test platforms was to have
conditional code scattered throughout config.py. New platforms would need
to add conditionals there. Alternatively, the new platform could set
no_default_flags to true, and reconstitue almost the entire compile and
link line, including things that don't vary across platforms.

The new way of supporting new platforms is to create a new target info
class, and have make_target_info return an instance of it. For platforms
supported in-tree, that will be done by modifying make_target_info. For
out-of-tree platforms, users can set LIBCXX_TARGET_INFO at cmake configure
time.

The target info sub-classes can provide fine-grained information back to
config.py. The hooks that will most commonly be provided will be
add_cxx_compile_flags and add_cxx_link_flags. These hooks can provide the
platform specific flags, while letting config.py handle all the invariant
flags.

Target info hooks were added for each area that the existing config.py had
platform specific behavior. config.py is now mostly free of platform
specific conditionals.

This patch was tested on Linux x86_64. I both targeted Linux x86_64, and
an out-of-tree platform with a custom target_info. In both cases I was
able to run libcxx and libcxxabi tests. I do not have access to FreeBSD,
Darwin, or Windows machines that are set up for lit testing.

llvm-svn: 256588
2015-12-29 22:21:38 +00:00
Eric Fiselier 7a608aa232 [libcxx] Fix LWG Issue #2367 - Fixing std::tuple and std::pair's default constructors.
Summary: This patch implements the solution for LWG Issue #2367. See http://cplusplus.github.io/LWG/lwg-active.html#2367

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 256325
2015-12-23 08:20:26 +00:00
Eric Fiselier 51b9de4c7c Fix type in tuple test. Sorry for the noise
llvm-svn: 255944
2015-12-18 01:04:36 +00:00
Eric Fiselier 545b8861fc [libcxx] LWG2485: get() should be overloaded for const tuple&&. Patch from K-Ballo.
Review: http://reviews.llvm.org/D14839
llvm-svn: 255941
2015-12-18 00:36:55 +00:00
Eric Fiselier 831c112954 Fix various GCC mis-configurations for newer versions.
This patch goes through and enables C++11 and C++14 features for newer GCC's.
The main changes are:

1. Turn on variable templates. (Uses __cpp_variable_templates)
2. Assert atomic<Tp> is trivially copyable (Uses _GNUC_VER >= 501).
3. Turn on trailing return support for GCC. (Uses _GNUC_VER >= 404)
4. XFAIL void_t test for GCC 5.1 and 5.2. Fixed in GCC 6.

llvm-svn: 255585
2015-12-15 00:32:21 +00:00
Eric Fiselier d5262627eb Update how libc++/libc++abi link the tests. Follow up on r255559.
llvm-svn: 255560
2015-12-14 22:24:19 +00:00
Marshall Clow 6e07ccdfe1 K-Ballo pointed out a mistake in the add_lvalue_ref tests I checked in; now more of them are passing. Thanks
llvm-svn: 255519
2015-12-14 18:11:51 +00:00
Marshall Clow 94b5bc4263 Fix a corner case that involved calling rethrow_if_nested with a type that had a deleted operator&. Added a test to catch this as well. Thanks to Ville for the heads-up.
llvm-svn: 255517
2015-12-14 18:01:56 +00:00
Marshall Clow 161eae2daa Add add_lvalue_ref tests for a few function types, with a note why not more
llvm-svn: 255513
2015-12-14 17:34:03 +00:00
Eric Fiselier fff5ec035b Use __make_integer_seq builtin for std::make_integer_sequence. Patch by K-ballo.
llvm-svn: 255162
2015-12-09 22:03:06 +00:00
Marshall Clow b8427293df Last bit of P0006; mark it as complete
llvm-svn: 254290
2015-11-30 05:39:30 +00:00
Marshall Clow 12dff9e66a Fix bugs in alignment_of_v, etc. Re-enable the newly added tests
llvm-svn: 254289
2015-11-30 05:20:00 +00:00
Marshall Clow 00b6b01592 Temporarily disable new tests while I figure out what's going on
llvm-svn: 254288
2015-11-30 05:15:10 +00:00
Marshall Clow c8f3816e63 Fix bad macros
llvm-svn: 254287
2015-11-30 05:10:10 +00:00
Marshall Clow 4ddfaea773 Implement more of P0006; Type Traits Variable Templates. <ratio>
llvm-svn: 254285
2015-11-30 05:04:22 +00:00
Marshall Clow 803a8bb105 Fix bad macros in tests
llvm-svn: 254284
2015-11-30 05:03:35 +00:00
Marshall Clow e12a536d76 Implement more of P0006; Type Traits Variable Templates.
llvm-svn: 254283
2015-11-30 04:30:02 +00:00
Marshall Clow 94f89aeec5 Add static_assert to set/multiset/map/multimap/forward_list/deque that the allocator's value_type match the container's value_type. vector/unordered/list/string already do this. Add tests for all the containers to verify this.
llvm-svn: 254119
2015-11-26 01:24:04 +00:00
Marshall Clow 9d73243bc1 Silence a -Wmissing-braces warning in the tests; mbstate_t is defined differently on different C libraries.
llvm-svn: 254050
2015-11-25 01:06:36 +00:00
Marshall Clow e0312a3047 Remove undefined behavior from tests; specifically, ensure that the value type of the allocators match the value type of the containers
llvm-svn: 254030
2015-11-24 22:10:51 +00:00
Eric Fiselier 1f6e22d1cc Fix bad variable name. project_root -> project_obj_root
llvm-svn: 253382
2015-11-17 21:48:29 +00:00
Marshall Clow 1867554cc6 Add tests for the extended integer types - as required by LWG#2119
llvm-svn: 253376
2015-11-17 21:04:24 +00:00
Marshall Clow dbd2d32892 Implement P0007: Constant View: A proposal for a std::as_const helper function template.
llvm-svn: 253274
2015-11-17 00:08:08 +00:00
Marshall Clow 28ec78e7a5 Fix compile error in test. Can't use `operator[]` for multimap.
llvm-svn: 253271
2015-11-16 23:40:27 +00:00
Marshall Clow b90e350017 More tests for LWG#2156
llvm-svn: 253257
2015-11-16 22:18:36 +00:00
Marshall Clow a9197737f9 LWG#2156 loosened the requirements on unordered containers 'rehash' calls. Add tests to make sure we meet these requirements. Since we met the stricter ones, no code change needed to meet the looser ones.
llvm-svn: 253223
2015-11-16 16:42:16 +00:00
Marshall Clow dd1b261f3a Implement P0013R1: Logical Operator Type Traits. Make a hidden implementation (__and_, __or_, and __not_) so that we can use them elsewhere in non-C++17 code - for example, in the LFTS
llvm-svn: 253215
2015-11-16 15:54:13 +00:00
Marshall Clow 183c010c9a Implement P0074: Making owner_less more flexible
llvm-svn: 252905
2015-11-12 15:56:44 +00:00
Asiri Rathnayake ea4282d336 [libcxx] Fixup a few fumbles in the initial no-exceptions XFAILs list.
The initial buildbot run found a few missing bits in the initial XFAIL list
for the no-exceptions libc++ variant. These discrepancies are as follows:

[1] Following two tests need XFAILs on the no-exceptions library variant.
My local runs had these two disabled for other reasons (unsupported):

  - localization/locales/locale/locale.cons/char_pointer.pass.cpp
  - numerics/complex.number/complex.ops/complex_divide_complex.pass.cpp

[2] These three does not need XFAILs, they were failing on my local runs for
other reasons:

  - depr/depr.c.headers/uchar_h.pass.cpp
  - input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
  - .../category.collate/locale.collate.byname/transform.pass.cpp

(these are failing on my box for the default build as well)

The current patch fixes both the cases above. Additionally, I've run the
following scan to make sure I've covered all the cases:

> grep ' catch \| try \| throw ' -R . | perl -pe 's|(.*?):.*|\1|' | sort | \
  uniq > 1.txt
> grep 'libcpp-no-exceptions' -R . | perl -pe 's|(.*?):.*|\1|' | sort | \
  uniq > 2.txt
> diff 1.txt 2.txt

This showed up a few extra interesting cases:

[3] These two tests do not use try/catch/throw statements, but they fail at
runtime. Need to be investigated, I've left the XFAILs in.

  - std/thread/futures/futures.shared_future/dtor.pass.cpp
  - std/thread/futures/futures.unique_future/dtor.pass.cpp

[4] These tests use a macro named TEST_HAS_NO_EXCEPTIONS to conditionally
exclude try/catch/throw statements when running without exceptions. I'm not
entirely sure why this was needed (AFAIK, we didn't have a no-exceptions
library build before). The macro's defintion is quite similar to that of
_LIBCPP_NO_EXCEPTIONS. I will investigate if this can be reused for my test
fixes or if it should be replaced with _LIBCPP_NO_EXCEPTIONS.

  - std/experimental/any/*

Change-Id: I9ad1e0edd78f305406eaa0ab148b1ab693f7e26a
llvm-svn: 252870
2015-11-12 10:41:57 +00:00
Marshall Clow d1180f4abc Fix typo I just introduced.
llvm-svn: 252614
2015-11-10 16:10:17 +00:00
Marshall Clow 41277d179f std:: qualify ptrdiff_t in the test. Thanks to Walter for the catch
llvm-svn: 252613
2015-11-10 16:04:13 +00:00
Marshall Clow d17405fe9c Walter pointed out some missing includes in the tests. Fixing the includes uncovered a couple bugs in the _v type traits. Fixed those, too
llvm-svn: 252612
2015-11-10 15:48:23 +00:00
Marshall Clow bfba968360 Explicitly #include <utility> so that we get std::move. Thanks to Walter for the bug report.
llvm-svn: 252610
2015-11-10 15:22:08 +00:00
Asiri Rathnayake f520c1445f Make it possible to build a no-exceptions variant of libcxx.
Fixes a small omission in libcxx that prevents libcxx being built when
-DLIBCXX_ENABLE_EXCEPTIONS=0 is specified.

This patch adds XFAILS to all those tests that are currently failing
on the new -fno-exceptions library variant. Follow-up patches will
update the tests (progressively) to cope with the new library variant.

Change-Id: I4b801bd8d8e4fe7193df9e55f39f1f393a8ba81a
llvm-svn: 252598
2015-11-10 11:41:22 +00:00
NAKAMURA Takumi 4c9c937542 Make check-libcxx Py3-compatible.
llvm-svn: 252458
2015-11-09 10:55:04 +00:00
Marshall Clow e5f1288fa0 Implement LWG#2353: std::next is over-constrained
llvm-svn: 252407
2015-11-07 17:48:49 +00:00
Marshall Clow 8be59af1ed More of P0006R0: type traits variable aliases for C++17.
llvm-svn: 252406
2015-11-07 17:44:36 +00:00
Evgeniy Stepanov 65da7bc392 Allow deque to handle incomplete types.
Allow deque and deque::iterator instantiation with incomplete element
type. This is an ABI breaking change, and it is only enabled if
LIBCXX_ABI_VERSION >= 2 or LIBCXX_ABI_UNSTABLE=ON.

llvm-svn: 252350
2015-11-06 22:02:29 +00:00
Marshall Clow 2cd0d6d625 Implement P0092R1 for C++1z
llvm-svn: 252195
2015-11-05 19:33:59 +00:00
Marshall Clow 79dfd99d30 Remove undefined behavior from some tests. Same pattern as the unitialized_copy tests
llvm-svn: 251804
2015-11-02 15:29:13 +00:00
Marshall Clow 8eb1d544f8 Remove undefined behavior from some tests. Thanks to Walter Brown for the heads-up.
llvm-svn: 251802
2015-11-02 15:25:53 +00:00
Marshall Clow 6028c03976 Add 'nostdinc++' to the flags used by testit. Makes the tests run better on Mac OS X with the new depr.c headers change
llvm-svn: 251768
2015-11-01 21:14:22 +00:00
Marshall Clow 00ec0bf828 Improve the tests for 'is_literal_type'
llvm-svn: 251767
2015-11-01 21:13:10 +00:00
Marshall Clow dd0ef09954 Implement the first part of P0006R0: Adopt Type Traits Variable Templates for C++17. Significantly augment the existing tests.
llvm-svn: 251766
2015-11-01 20:24:59 +00:00
Marshall Clow 131733bcf0 Implement P0004R1 'Remove Deprecated iostreams aliases'
llvm-svn: 251618
2015-10-29 05:43:30 +00:00
Matthias Braun cb668426c1 Adapt to lit change in llvm r251478-r251481
Sorry for the breakage.

llvm-svn: 251529
2015-10-28 17:20:33 +00:00
Eric Fiselier 4630f63a64 Fix test suite configuration. Sorry Marshall
llvm-svn: 251334
2015-10-26 19:08:53 +00:00
Marshall Clow 3b72a6ef63 Fix LWG#2489: mem_fn() should be noexcept
llvm-svn: 251257
2015-10-25 20:12:16 +00:00
Marshall Clow 531c41e1b8 Add the tests for the last commit
llvm-svn: 251254
2015-10-25 19:53:29 +00:00
Marshall Clow b631c24359 Add a test for LWG#2466: allocator_traits::max_size() default behavior is incorrect
llvm-svn: 251252
2015-10-25 19:34:04 +00:00
Marshall Clow d9977010d0 Add a test for LWG#2462: std::ios_base::failure is overspecified
llvm-svn: 251250
2015-10-25 19:20:14 +00:00
Marshall Clow 2603b0758d Fix LWG#2127: Move-construction with raw_storage_iterator.
llvm-svn: 251247
2015-10-25 18:58:07 +00:00
Marshall Clow 9be5356452 Fix LWG#2244: basic_istream::seekg
llvm-svn: 251246
2015-10-25 18:31:51 +00:00
Tim Northover a745ddd9a7 Set LC_COLLATE rather than LANG to override collation.
On a system with LC_COLLATE=C, this takes precedence over a non-C LANG
the test tries to impose and the test fails.

llvm-svn: 251131
2015-10-23 17:56:08 +00:00
Eric Fiselier 8241405ad4 [libcxx] Make it drastically simpler to link libc++.
Summary:
Currently on most platforms you have to manually link the c++ abi library used with libc++ whenever you use libc++. So your typical libc++ command like invocation might look like:

```
clang++ -stdlib=libc++ foo.cpp -lc++abi
```

Having to manually link `libc++abi.so` makes it harder for libc++ to be used generically. This patch fixes that by generating a linker script for `libc++.so` that correctly links the ABI library. On linux the linker script for libc++abi would look like:

```
# libc++.so
INPUT(libc++.so.1 -lc++abi)
```

With the linker script you can now use libc++ using only `-stdlib=libc++`. This is the technique that is used on FreeBSD in ordered to link cxxrt and I think it's the best approach to make our users lives simpler.

The CMake option used to enable this is `LIBCXX_ENABLE_ABI_LINKER_SCRIPT`. In future I would like to enable this by default on all platforms except for Darwin.

Reviewers: mclow.lists, danalbert, rsmith, jroelofs, EricWF

Subscribers: cfe-commits

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

llvm-svn: 250319
2015-10-14 19:54:03 +00:00
Eric Fiselier f71de32d7b Split out config_site logic so libc++abi can use it
llvm-svn: 250312
2015-10-14 19:00:35 +00:00
Eric Fiselier 0a534eec65 [libcxx] Use __config_site to configure the test suite features.
Summary:
This patch changes the tests to use the "__config_site" header if present instead of manually configuring for each option. This patch also removes the test flags for configuring some of these options. For example "lit -sv --param=enable_threads=OFF" no longer works. However lit will still correctly configure if  the CMake option "-DLIBCXX_ENABLE_THREADS=OFF" is given at build time. 

This patch will fix the libc++abi test configuration for `LIBCXX_ABI_VERSION` and `LIBCXX_ABI_UNSTABLE` one we teach it about 'project_obj_dir' . I would like to land this ASAP to prevent more work blockage.

Reviewers: mclow.lists, danalbert, eugenis, ed, jroelofs

Subscribers: cfe-commits

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

llvm-svn: 250308
2015-10-14 18:22:15 +00:00
Eric Fiselier 29ada6d178 Use __config_site when building libc++. Also cleanup ABI versioning doc
llvm-svn: 250261
2015-10-14 00:22:05 +00:00
Evgeniy Stepanov a66a7b30ce ABI versioning macros for libc++.
C++ macros and CMake options that specify the default ABI version of
the library, and can be overridden to pick up new ABI-changing
features.

llvm-svn: 250254
2015-10-13 23:48:28 +00:00
Richard Smith f157e47fb8 Fix use of libc++ <foo.h> headers from within an 'extern "C"' context in C++98.
Previously, this resulted in us declaring a template for static_assert emulation within the 'extern "C"' context, which is ill-formed.

llvm-svn: 250247
2015-10-13 23:12:22 +00:00
Chris Bieneman 7c6a3b4c47 [Darwin] Reworking r250003 to use lit.util.capture instead of subprocess.
llvm-svn: 250007
2015-10-12 02:54:30 +00:00
Chris Bieneman e99983b2df [Darwin] Need to add -isysroot on OS X otherwise the tests will fail if you don't have the command line tools package installed.
This mirrors how other LLVM suites are configured for running on OS X.

llvm-svn: 250003
2015-10-12 00:49:56 +00:00
Eric Fiselier d2a4553d52 Revert r249931 - Remove same_decls.pass.cpp because it fails on OS X and in C++03 mode.
llvm-svn: 249938
2015-10-10 03:31:23 +00:00
Eric Fiselier 448dd41588 Get some of wchar_h.pass.cpp working on apple.
llvm-svn: 249936
2015-10-10 02:54:41 +00:00
Richard Smith 0ecae015ff Unrevert r249889, and XFAIL the test for Darwin, where the libc apparently doesn't provide a correct overload set for some functions.
llvm-svn: 249932
2015-10-10 01:39:51 +00:00
Richard Smith 3cfee3d010 Add a test that we declare the right set of C library function signatures in ::
and std::, and that the names in :: and std:: are declaring the same entity.

llvm-svn: 249931
2015-10-10 01:33:17 +00:00
Manman Ren 79d8bc4c88 Revert r249889 due to bot failure.
llvm-svn: 249926
2015-10-10 01:03:55 +00:00
Richard Smith 897758d6ba Split <wchar.h> out of <cwchar>.
llvm-svn: 249889
2015-10-09 19:56:37 +00:00
Richard Smith a51c8eee6e Split <stdlib.h> out of <cstdlib>.
llvm-svn: 249800
2015-10-09 01:41:45 +00:00
Richard Smith d32827408e Split <stdio.h> out of <cstdio>.
As with <stddef.h>, skip our custom header if __need_FILE or __need___FILE is defined.

llvm-svn: 249798
2015-10-09 01:29:09 +00:00
Richard Smith 55a7a2481b Fix test failure in C++98 mode due to imperfect static_assert emulation.
llvm-svn: 249780
2015-10-08 23:44:26 +00:00
Richard Smith d6cffc4fe0 Split <stddef.h> out of <cstddef>.
There are a bunch of macros (__need_size_t etc) that request just one piece of
<stddef.h>; if any one of these is defined, we just directly include the
underlying header.

Note that <stddef.h> provides a ::nullptr_t. We don't want that available to
includers of <cstddef>, so instead of following the usual pattern where <cfoo>
includes <foo.h> then pulls things from :: into std:: with using-declarations,
we implement <stddef.h> and <cstddef> separately; both include <__nullptr> for
the definition of std::nullptr_t.

llvm-svn: 249761
2015-10-08 22:25:27 +00:00
Richard Smith 38a2a28ff7 Split <setjmp.h> out of <csetjmp>.
llvm-svn: 249743
2015-10-08 20:41:26 +00:00
Richard Smith 524956bb3d Split <math.h> out of <cmath>.
llvm-svn: 249742
2015-10-08 20:40:34 +00:00
Richard Smith 37df7a05c2 Split <inttypes.h> out of <cinttypes>.
llvm-svn: 249741
2015-10-08 20:38:53 +00:00
Richard Smith f80c1b7331 Split <ctype.h> out of <cctype>.
llvm-svn: 249738
2015-10-08 20:36:30 +00:00
Marshall Clow 2a7b00e166 While researching LWG#2244, I noticed we weren't testing that eofbit was being cleared. Now we are
llvm-svn: 249593
2015-10-07 19:41:24 +00:00
Marshall Clow 05e9cb5636 Our test allocators support move/copy construction; they should support move/copy assignment as well
llvm-svn: 249458
2015-10-06 20:30:56 +00:00
Marshall Clow e652e4dae1 Fixed a possible overflow in a test of allocator::max_size().
llvm-svn: 249349
2015-10-05 20:50:25 +00:00
Marshall Clow 8428a9d5b6 Implement LWG#2063, and update the issues links to point to the github generated pages
llvm-svn: 249325
2015-10-05 16:17:34 +00:00
Eric Fiselier ca95c286f0 [libcxx] Use newest supported language dialect when running the test suite.
Summary:
Currently the test suite defaults to C++11 mode if no standard version is supplied to LIT using `--param=std=c++XX`.  This patch changes that behavior so that the newest possible dialect is selected instead.

I have already patched the C++11 bot to explicitly specify `--param=std=c++11`. I'm just putting this up for review to see if anybody objects to this idea.

Reviewers: mclow.lists, jroelofs, danalbert

Subscribers: cfe-commits

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

llvm-svn: 249226
2015-10-03 02:32:23 +00:00
Eric Fiselier 7362982e62 Attempt to prevent flaky thread.mutex tests by once again increasing timing tolerances
llvm-svn: 248993
2015-10-01 08:34:37 +00:00
Eric Fiselier d866bdd692 Manually suppress -Wnonnull when it occurs in an unevaluated context
llvm-svn: 248989
2015-10-01 07:41:07 +00:00
Eric Fiselier b4e2e7a292 Suppress array initialization warnings in std::experimental::apply tests
llvm-svn: 248987
2015-10-01 07:05:38 +00:00
Eric Fiselier f74bb3b8b0 Dont link -lrt in the testsuite on linux unless using sanitizers.
llvm-svn: 248986
2015-10-01 06:15:26 +00:00
Marshall Clow e8fe34d4d1 The test I cnecked in to check the fix for PR#24890 failed (as expected) w/o the fix, but for the wrong reason. Now it fails for the right reason.
llvm-svn: 248307
2015-09-22 18:09:13 +00:00
Marshall Clow 835e77e29e Check in the test for PR#24890 that I forgot in previous commit
llvm-svn: 248305
2015-09-22 17:57:41 +00:00
Marshall Clow 20ade932fb Suppress some warnings in the tests that snuck in. That 'tmpnam' is deprecated doesn't change the fact that we have to test it.
llvm-svn: 247704
2015-09-15 17:12:49 +00:00
Marshall Clow f979baabbb Change initialization of mbstate_t objects in tests from '= {0}' to '= {}', which does the same thing, w/o having clang and gcc warn with -Wall.
llvm-svn: 247695
2015-09-15 14:46:03 +00:00
Marshall Clow f44bd93bec Implementation of Boyer-Moore and Boyer-Moore-Horspool searchers for the LFTS.
llvm-svn: 247036
2015-09-08 17:59:09 +00:00
Eric Fiselier 21dfbfb426 make common_type SFINAE-friendly and support void. Patch from Agustin Berge.
This patch also fixes PR22135. (https://llvm.org/bugs/show_bug.cgi?id=22135)
See the review for more information: http://reviews.llvm.org/D6964

llvm-svn: 246977
2015-09-08 00:13:57 +00:00
Eric Fiselier 888d91a9e4 Move __lazy_* metafunctions to type traits and add tests
llvm-svn: 246408
2015-08-31 03:50:31 +00:00
Eric Fiselier d49455ef93 Suppress clang warnings in some tests
llvm-svn: 246399
2015-08-30 22:04:20 +00:00
Eric Fiselier de1495b9b6 Remove task to get C++03 tests passing from TODO.txt
llvm-svn: 246392
2015-08-30 17:58:50 +00:00
Eric Fiselier 1e051aab0c Finally get the test suite passing in C++03!!
After months of work there are only 4 tests still failing in C++03.
This patch fixes those tests.

All of the libc++ builders should be green.

llvm-svn: 246275
2015-08-28 05:46:17 +00:00
Eric Fiselier 8ec5189656 Remove empty file that arcanist created
llvm-svn: 246273
2015-08-28 05:18:13 +00:00
Eric Fiselier cb38f75e29 [libcxx] Mark most test/std/future tests as UNSUPPORTED in C++03
Summary:
This patch marks *most* tests for `std::promise`, `std::future` and `std::shared_future` as unsupported in C++03. These tests fail in C++03 mode because they attempt to copy a `std::future` even though it is a `MoveOnly` type. AFAIK the missing move-semantics in `std::future` is the only reason these tests fail but without move semantics these classes are useless. For example even though `std::promise::set_value` and `std::promise::set_exception(...)` work in C++03 `std::promise` is still useless because we cannot call `std::promise::get_future(...)`.

It might be possible to hack `std::move(...)` like we do for `std::unique_ptr` to make the move semantics work but I don't think it is worth the effort. Instead I think we should leave the `<future>` header as-is and mark the failing tests as `UNSUPPORTED`. I don't believe there are any users of `std::future` or `std::promise` in C++03 because they are so unusable. Therefore I am not concerned about losing test coverage and possibly breaking users. However because there are still parts of `<future>` that work in C++03 it would be wrong to `#ifdef` out the entire header.

@mclow.lists Should we take further steps to prevent the use of `std::promise`, `std::future` and `std::shared_future` in C++03?


Note: This patch also cleans up the tests and converts them to use `support/test_allocator.h` instead of a duplicate class in `test/std/futures/test_allocator.h`.

Reviewers: mclow.lists

Subscribers: vsk, mclow.lists, cfe-commits

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

llvm-svn: 246271
2015-08-28 05:06:04 +00:00
Eric Fiselier fc8e8c0360 Fix bug in test_allocator<void> that used the wrong value to represent object state
llvm-svn: 246270
2015-08-28 05:00:25 +00:00
Eric Fiselier 4b30e569be [libcxx] Add special warning flag detection logic to compiler.py
Summary: Detecting `-Wno-<warning>` flags can be tricky with GCC (See https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html). This patch adds a special `addWarningFlagIfSupported(<flag>)` method to the test compiler object that can be used to add warning flags. The goal of this patch is to help get the test suite running with more warnings.

Reviewers: danalbert, jroelofs

Subscribers: cfe-commits

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

llvm-svn: 246069
2015-08-26 20:17:33 +00:00
Eric Fiselier 70192a9efb [libcxx] Rewrite C++03 __invoke.
Summary:
This patch rewrites the C++03 `__invoke` and related meta-programming. There are a number of major changes.

`__invoke` in C++03 now has a fallback overload for when the invoke expression is ill-formed (similar to C++11). This means that the `__invoke_return` traits will return `__nat` when `__invoke(...)` is ill formed. This would previously cause a compile error.

Bullets 1-4 of `__invoke` have been rewritten. In the old version `__invoke` had 32 overloads for bullets 1 and 2,
one for each possible cv-qualified function signature with arities 0-3. 64 overloads would be needed to support member functions
with varargs. Currently these overloads were fundamentally broken. An example overload looked like:
```
template <class Rp, class Tp, class T1, class A0>
Rp __invoke(Rp (Tp::*pm)(A0) const, T1&, A0&)
```
Because `A0` appeared in two different deducible contexts it would have to deduce to be an exact match or the overload
would be rejected. This is made even worse because `A0` appears without a reference qualifier in the member function signature
and with a reference qualifier as an `__invoke` parameter. This means that only member functions that took all
of their arguments by value could be matched.

One possible fix would be to make the second occurrence of `A0` appear in a non-deducible context. This way
any type convertible to `A0` could be passed as the first parameter. The benefit of this approach is that the
signature of the member function enforces the arity and types taken by the `__invoke` signature it generates. However
nothing in the `INVOKE` specification requires this behavior.

My solution is to use a `__invoke_enable_if<PM_Type, Tp>`  metafunction to selectively enable the `__invoke` overloads for bullets 1, 2, 3 and 4.  It uses `__member_function_traits` to inspect and extract the return type and class type of the pointer to member. Using `__member_function_traits` to inspect `PM_Type` also allows us to reduce the number of `__invoke` overloads from 32 to 8 and add
varargs support at the same time.

Because `__invoke_enable_if` knows the exact return type of `__invoke` for bullets 1-4 we no longer need to use `decltype(__invoke(...))` to
compute the return type in the `__invoke_return*` traits. This will reduce the problems caused by `#define decltype(X) __typeof__(X)` in C++03.

Tests for this change have already been committed. All tests in `test/std/utilities/function.objects` now pass in C++03, previously there were 20 failures.

Reviewers: K-ballo, howard.hinnant, mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 246068
2015-08-26 20:15:02 +00:00
Eric Fiselier b610a45c7b Refactor flaky shared_mutex tests
llvm-svn: 246055
2015-08-26 19:04:40 +00:00
Eric Fiselier 44d9307293 Remove XFAIL in test. The bug causing it has been fixed.
llvm-svn: 246022
2015-08-26 07:03:43 +00:00
Eric Fiselier bc385daaf7 Mark test as XFAIL with MSAN until D12311 gets committed
llvm-svn: 245922
2015-08-25 04:35:55 +00:00
Eric Fiselier fb65a3a657 Refactor and fix more flaky shared_mutex tests
llvm-svn: 245918
2015-08-25 01:28:52 +00:00
Eric Fiselier b76b5b255d Move test/std/utilities/date.time to proper stable name utilities/time/date.time
llvm-svn: 245877
2015-08-24 21:27:25 +00:00
Jonathan Roelofs 91b3a5e7c5 Misc drive-by cleanups. NFC
http://reviews.llvm.org/D12294

llvm-svn: 245876
2015-08-24 21:20:07 +00:00
Marshall Clow 550dfe79ca Fix a crasher found by libFuzzer
llvm-svn: 245849
2015-08-24 15:57:09 +00:00
Eric Fiselier 1c81340797 Recommit rL245802: Cleanup fancy pointer rebinding in list using __rebind_pointer.
Currently we need an #ifdef branch every time we use pointer traits to rebind a pointer because
it is done differently in C++11 and C++03. This patch introduces the __rebind_pointer utility to
clean this up.

Also add a test that list and it's iterators can be instantiated with incomplete element types.

llvm-svn: 245806
2015-08-23 02:56:05 +00:00
Eric Fiselier 4c0a2a989b Refactor shared_timed_mutex tests.
First I removed all of the uses of _LIBCPP_STD_VER and added LIT UNSUPPORTED tags to prevent the tests from being run in older standard dialects.
Second I increased the time tolerances used in some tests when testing with Thread Sanitizer because thread sanitizer make these tests take longer.

llvm-svn: 245793
2015-08-22 21:24:01 +00:00
Eric Fiselier 60ab5bcaab Fix a typo: abreviated -> abbreviated - Patch from Kai Zhao
llvm-svn: 245538
2015-08-20 05:20:29 +00:00