Commit Graph

1883 Commits

Author SHA1 Message Date
Stephan T. Lavavej 73876facd5 [libcxx] [test] D27016: Fix MSVC warning C4018 "signed/unsigned mismatch", part 4/12.
Change "int j;" indices to "std::size_t j;".

Also, include <cstddef> when it wasn't already being included.

llvm-svn: 287824
2016-11-23 22:02:27 +00:00
Stephan T. Lavavej afe99ae092 [libcxx] [test] D27015: Fix MSVC warning C4018 "signed/unsigned mismatch", part 3/12.
Change unsigned to int in parameters.

llvm-svn: 287823
2016-11-23 22:02:16 +00:00
Stephan T. Lavavej a11d322f0d [libcxx] [test] D27014: Fix MSVC warning C4018 "signed/unsigned mismatch", part 2/12.
Add static_cast<std::size_t> when comparing int to std::size_t.

Also, include <cstddef> when it wasn't already being included.

llvm-svn: 287822
2016-11-23 22:01:58 +00:00
Stephan T. Lavavej e898b484f6 [libcxx] [test] D27013: Fix MSVC warning C4018 "signed/unsigned mismatch", part 1/12.
Change loop indices from int to std::size_t.

Also, include <cstddef> when it wasn't already being included.

llvm-svn: 287820
2016-11-23 22:01:19 +00:00
Eric Fiselier 341c9dd9c4 Fix __hash_table::max_size() on 32 bit systems
llvm-svn: 287749
2016-11-23 09:16:12 +00:00
Casey Carter ca1c5e0fb6 Don't "LIBCPP_ONLY(stuff;)" at namespace scope.
Differential review: https://reviews.llvm.org/D27029

llvm-svn: 287732
2016-11-23 01:44:53 +00:00
Eric Fiselier 55b31b4e69 [libcxx] Fix max_size() across all containers
Summary: The `max_size()` method of containers should respect both the allocator's reported `max_size` and the range of the `difference_type`. This patch makes all containers choose the smallest of those two values.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 287729
2016-11-23 01:18:56 +00:00
Eric Fiselier 80e66ac1d3 Add <variant> tests but disable them for libc++
llvm-svn: 287728
2016-11-23 01:02:51 +00:00
Eric Fiselier 7216b6bc38 Attempt to fix stdint/cstdint modules try 2
llvm-svn: 287690
2016-11-22 20:05:19 +00:00
Eric Fiselier 67a7e935a3 Revert r287435 because of OS X test failures
llvm-svn: 287531
2016-11-21 11:26:10 +00:00
Eric Fiselier 43b5523069 Mark variadic lock guard tests as XFAIL with modules, since they have to define macros to expose the new ABI
llvm-svn: 287513
2016-11-21 01:10:52 +00:00
Eric Fiselier 11869aeb49 Adjust uses_alloc_types helpers for later changes
llvm-svn: 287512
2016-11-21 00:41:32 +00:00
Eric Fiselier 72d302b9ed Fix stdint/cstdint modules
llvm-svn: 287435
2016-11-19 03:29:03 +00:00
Eric Fiselier 3a528e2936 Mark test as unsupported in C++03
llvm-svn: 287417
2016-11-19 01:38:00 +00:00
Eric Fiselier 074d46d55f [libcxx] Implement locale.h to fix modules build
Summary:
Because `locale.h` isn't part of the libc++ modules the class definitions it provides are exported as part of `__locale` (since it happens to be build first). This breaks `<clocale>` which exports `std::lconv` without including `<__locale>`.

This patch implements `locale.h` to fix this issue, it also adds support for testing libc++ with modules.




Reviewers: mclow.lists, rsmith, EricWF

Subscribers: cfe-commits

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

llvm-svn: 287413
2016-11-19 01:14:15 +00:00
Stephan T. Lavavej ae3c4eec5a [libcxx] [test] D26812: In random tests, use real static_asserts and silence a warning.
In C++11 mode and newer, use real static_asserts.
In C++03 mode, min() and max() aren't constexpr, so use plain asserts.

One test triggers MSVC's warning C4310 "cast truncates constant value".
The code is valid, and yet the warning is valid, so I'm silencing it
through push-disable-pop.

llvm-svn: 287391
2016-11-18 22:45:32 +00:00
Stephan T. Lavavej 09c311b9a4 [libcxx] [test] D26816: Fix non-Standard assumptions when testing sample().
sample() isn't specified with a reproducible algorithm, so expecting
exact output is non-Standard. Mark those tests with LIBCPP_ASSERT.

In test_small_population(), we're guaranteed to get all of the elements,
but not necessarily in their original order. When PopulationCategory is
forward, we're guaranteed stability (and can therefore test equal()).
Otherwise, we can only test is_permutation(). (As it happens, both libcxx
and MSVC's STL provide stability in this scenario for input-only iterators.)

llvm-svn: 287383
2016-11-18 21:54:43 +00:00
Stephan T. Lavavej b04c795e24 [libcxx] [test] D26815: Fix an assumption about the state of moved-from std::functions.
The Standard doesn't provide any guarantees beyond "valid but unspecified" for
moved-from std::functions. libcxx moves from small targets and leaves them
there, while MSVC's STL empties out the source. Mark these assertions as
libcxx-specific.

llvm-svn: 287382
2016-11-18 21:54:38 +00:00
Stephan T. Lavavej e57a2a3144 [libcxx] [test] D26813: allocator<const T> is non-Standard.
N4582 17.6.3.5 [allocator.requirements] says that allocators are given
cv-unqualified object types, and N4582 20.9.9 [default.allocator]
implies that allocator<const T> is ill-formed (due to colliding
address() overloads). Therefore, tests for allocator<const T>
should be marked as libcxx-specific (if not removed outright).

llvm-svn: 287381
2016-11-18 21:54:31 +00:00
Eric Fiselier 371ecc6398 Remove files missed in r287250
llvm-svn: 287251
2016-11-17 19:24:34 +00:00
Eric Fiselier 66ddd34e8d Test changes for P0504R0 "Revisiting in-place tag types for any/optional/variant". Patch from Casey Carter
llvm-svn: 287249
2016-11-17 19:23:35 +00:00
Eric Fiselier c2b49f5abb Fix -verify tests for older ccache versions
llvm-svn: 287109
2016-11-16 14:48:42 +00:00
Justin Lebar 20cb820880 [libcxx] Mark xonstexpr-fns.pass.cpp as XFAIL: gcc.
This fails with gcc because __builtin_isnan and friends, which
libcpp_isnan and friends call, are not themselves constexpr-evaluatable.

llvm-svn: 287041
2016-11-15 22:03:29 +00:00
Justin Lebar 2d3482287b [CUDA] Mark __libcpp_{isnan,isinf,isfinite} as constexpr.
Summary:
This makes these functions available on host and device, which is
necessary to compile <complex> for the device.

Reviewers: hfinkel, EricWF

Subscribers: cfe-commits

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

llvm-svn: 287012
2016-11-15 19:15:57 +00:00
Vedant Kumar 50d161ce0f Revert "P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests."
This reverts commit r286884, because it breaks the Xcode 7 builders:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/1583

Here is a PR that tracks the issue:
https://llvm.org/bugs/show_bug.cgi?id=31016

llvm-svn: 287004
2016-11-15 18:48:36 +00:00
Stephan T. Lavavej 6d279e8e98 [libcxx] [test] D26627: Fix ordering assumptions in unordered container tests.
llvm-svn: 286984
2016-11-15 17:00:38 +00:00
Stephan T. Lavavej 64bac8b5fe [libcxx] [test] D26625: future_error::what() is implementation-defined.
llvm-svn: 286983
2016-11-15 17:00:32 +00:00
Stephan T. Lavavej 49188b1d3c [libcxx] [test] D26624: Fix bucket_count() assumptions.
With a max_load_factor of 1.0, the only guarantee is that
bucket_count() >= size(). (Note: setting max_load_factor without
rehashing isn't supposed to affect this, because setting
max_load_factor is currently specified to be constant time.)

llvm-svn: 286982
2016-11-15 17:00:24 +00:00
Marshall Clow f7182fe464 Missed one of the try blocks the first time :-(. Thanks to Renato for the heads up.
llvm-svn: 286932
2016-11-15 05:03:22 +00:00
Marshall Clow 48b520a7b6 P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests.
llvm-svn: 286884
2016-11-14 20:41:17 +00:00
Marshall Clow 209fc55b01 Missed a test with exceptions disabled earlier. Oops.
llvm-svn: 286883
2016-11-14 20:38:43 +00:00
Marshall Clow 065b3af096 Implement P0516: 'Clarify That shared_future’s Copy Operations have Wide Contracts' which was adopted last week in Issaquah
llvm-svn: 286877
2016-11-14 19:58:05 +00:00
Marshall Clow 10e59fac3e Make one of the new tests fail correctly on pre-C++17 systems
llvm-svn: 286872
2016-11-14 19:35:34 +00:00
Marshall Clow 87f2f1687e Implement P0510 'Make future_error Constructible' adopted in Issaquah
llvm-svn: 286864
2016-11-14 18:56:24 +00:00
Marshall Clow 1c7fe126ee Fixes for LWG 2598, 2686, 2739, 2742, 2747, and 2759, which were adopted last week in Issaquah
llvm-svn: 286858
2016-11-14 18:22:19 +00:00
Stephan T. Lavavej 4dc0ed8390 [libcxx] [test] D26314: Fix MSVC warning C4189 "local variable is initialized but not referenced".
test/std/depr/depr.c.headers/inttypes_h.pass.cpp
test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
test/std/input.output/iostream.forward/iosfwd.pass.cpp
Add test() to avoid a bunch of void-casts, although we still need a few.

test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
skippingws was unused (it's unclear to me whether this was mistakenly copy-pasted from round_trip() below).

test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp
test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp
test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp
test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
When retrieving facets, the references are unused.

test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp
test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp
"std::ios_base::iostate err = ios.goodbit;" was completely unused here.

test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp
test/std/numerics/c.math/ctgmath.pass.cpp
test/std/numerics/rand/rand.device/entropy.pass.cpp
test/std/numerics/rand/rand.device/eval.pass.cpp
test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp
test/std/thread/futures/futures.promise/dtor.pass.cpp
test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
These variables are verifying types but are otherwise unused.

test/std/strings/basic.string/string.capacity/reserve.pass.cpp
old_cap was unused (it's unclear to me whether it was intended to be used).

test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp
These tests contained unused characters.

llvm-svn: 286847
2016-11-14 17:35:14 +00:00
Roger Ferrer Ibanez aa35ecfecd Protect std::ios tests under libcpp-no-exceptions
Skip tests that expect an exception be thrown. Also add
some missing asserts in the original test.

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

llvm-svn: 286823
2016-11-14 13:44:50 +00:00
Roger Ferrer Ibanez 059680f3f0 Protect nested-exceptions tests under no-exceptions
Differential Revision: https://reviews.llvm.org/D26458

llvm-svn: 286813
2016-11-14 11:00:28 +00:00
Roger Ferrer Ibanez 84c152a130 Update tests for strings conversions under libcpp-no-exceptions
Differential Revision: https://reviews.llvm.org/D26139

llvm-svn: 286812
2016-11-14 10:44:26 +00:00
Roger Ferrer Ibanez 4a152f147f Protect smart-pointer tests under no exceptions
Skip tests that expect an exception be thrown under no-exceptions.

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

llvm-svn: 286809
2016-11-14 10:27:56 +00:00
Eric Fiselier 79ff8f0375 Fix GCC libc++abi build
llvm-svn: 286783
2016-11-13 22:27:00 +00:00
Eric Fiselier 2371589266 Implement LWG 2770 - Make tuple_size<T> defined for all T
llvm-svn: 286779
2016-11-13 20:43:50 +00:00
Eric Fiselier 40905833b5 Fix PR30979 - tuple<move_only> is constructible from move_only const&
llvm-svn: 286774
2016-11-13 19:54:31 +00:00
Roger Ferrer Ibanez aee391b535 Protect bitset tests under libcpp-no-exceptions
Bitset tests feature a sequence of tests of increasing bitset sizes,
but these tests rely on exceptions when the bitset size is less than
50 elements.

This change adds a flag to tell whether a test should throw. If it must
throw it will be skipped under no-exceptions.

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

llvm-svn: 286474
2016-11-10 16:54:55 +00:00
Roger Ferrer Ibanez a5672e0c4b Protect std::experimental::optional tests under libcpp-no-exceptions
In these tests there are some paths that explicitly throw, so use
the TEST_THROW macro that was proposed for this and then skip the tests
that may enter the throwing path.

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

llvm-svn: 286099
2016-11-07 08:23:59 +00:00
Stephan T. Lavavej 0f901c7ec4 [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.
This replaces every occurrence of _LIBCPP_STD_VER in the tests with
TEST_STD_VER. Additionally, for every affected
file, #include "test_macros.h" is being added explicitly if it wasn't
already there.

https://reviews.llvm.org/D26294

llvm-svn: 286007
2016-11-04 20:26:59 +00:00
Marshall Clow 720ef47200 Implement another part of P0031; adding constexpr to move_iterator
llvm-svn: 285818
2016-11-02 15:30:26 +00:00
Roger Ferrer Ibanez 50e59f3b60 Remove spurious token from #endif
llvm-svn: 285792
2016-11-02 08:36:43 +00:00
Roger Ferrer Ibanez 8c6562398e Protect tests for new/delete under libcpp-no-exceptions
Skip the tests that expect an exception be thrown and protect unreachable catch blocks.

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

llvm-svn: 285791
2016-11-02 08:14:57 +00:00
Eric Fiselier 0b460e6bf8 Fix __libcpp_is_constructible for source types with explicit conversion operators.
Previously __libcpp_is_constructible checked the validity of reference
construction using 'eat<To>(declval<From>())' but this doesn't consider
From's explicit conversion operators. This patch teaches __libcpp_is_constructible
how to handle these cases. To do this we need to check the validity
using 'static_cast<To>(declval<From>())'. Unfortunately static_cast allows
additional base-to-derived and lvalue-to-rvalue conversions, which have to be
checked for and manually rejected.

While implementing these changes I discovered that Clang incorrectly
rejects `static_cast<int&&>(declval<float&>())` even though
`int &&X(declval<float&>())` is well formed. In order to tolerate this bug
the `__eat<T>(...)` needs to be left in-place. Otherwise it could be replaced
entirely with the new static_cast implementation.

Thanks to Walter Brown for providing the test cases.

llvm-svn: 285786
2016-11-02 03:57:34 +00:00
Roger Ferrer Ibanez 8a915ed644 Protect exceptional paths under libcpp-no-exceptions
These tests are of the form

try {
   action-that-may-throw
   assert(!exceptional-condition)
   assert(some-other-facts)
 } catch (relevant-exception) {
   assert(exceptional-condition)
 }

Under libcpp-no-exceptions there is still value in verifying
some-other-facts while avoiding the exceptional case. So for these tests
just conditionally check some-other-facts if exceptional-condition is
false. When exception are supported make sure that a true
exceptional-condition throws an exception

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

llvm-svn: 285697
2016-11-01 15:46:16 +00:00
Roger Ferrer Ibanez 60d6ef63a4 Protect lock tests under libcpp-no-exceptions
Skip tests that expect an exception to be thrown.

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

llvm-svn: 285695
2016-11-01 15:00:16 +00:00
Roger Ferrer Ibanez 8cba0befb4 Protect tests that expect an exception for an unknown std::random_device
Skip these tests under libcpp-no-exceptions.

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

llvm-svn: 285677
2016-11-01 08:11:12 +00:00
Roger Ferrer Ibanez c6a40d24d0 Fix archetypes.hpp under libcpp-no-extensions and std level < 14
Under -fno-exceptions TEST_THROW becomes abort / __builtin_abort which returns
void. This causes a type mismatch in the conditional operator when testing the
library in C++98,03,11 modes.

Use a comma operator to workaround this problem.

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

llvm-svn: 285572
2016-10-31 14:14:13 +00:00
Roger Ferrer Ibanez 3565c96d86 Change from "XFAIL: libcpp-no-exceptions" to "UNSUPPORTED: libcpp-no-exceptions" tests that only check exceptions and nothing else
This is a follow up of D24562.

These tests do not check anything but exceptions, so it makes sense to mark
them as UNSUPPORTED under a library built without exceptions.

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

llvm-svn: 285550
2016-10-31 08:47:53 +00:00
Eric Fiselier 7ca76565e7 Fix _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY to always have default visibility.
This prevent the symbols from being both externally available and hidden, which
causes them to be linked incorrectly. This is only a problem when the address
of the function is explicitly taken since it will always be inlined otherwise.

This patch fixes the issues that caused r285456 to be reverted, and can
now be reapplied.

llvm-svn: 285531
2016-10-31 02:07:23 +00:00
Eric Fiselier 1467a197e5 Rewrite std::filesystem::path iterators and parser
This patch entirely rewrites the parsing logic for paths. Unlike the previous
implementation this one stores information about the current state; For example
if we are in a trailing separator or a root separator. This avoids the need for
extra lookahead (and extra work) when incrementing or decrementing an iterator.
Roughly this gives us a 15% speedup over the previous implementation.

Unfortunately this implementation is still a lot slower than libstdc++'s.
Because libstdc++ pre-parses and splits the path upon construction their
iterators are trivial to increment/decrement. This makes libc++ lazy parsing
100x slower than libstdc++. However the pre-parsing libstdc++ causes a ton
of extra and unneeded allocations when constructing the string. For example
`path("/foo/bar/")` would require at least 5 allocations with libstdc++
whereas libc++ uses only one. The non-allocating behavior is much preferable
when you consider filesystem usages like 'exists("/foo/bar/")'.

Even then libc++'s path seems to be twice as slow to simply construct compared
to libstdc++. More investigation is needed about this.

llvm-svn: 285526
2016-10-30 23:30:38 +00:00
Eric Fiselier d03a5ffcf6 Remove files missed in r285466
llvm-svn: 285469
2016-10-28 22:54:24 +00:00
Eric Fiselier a32a961b10 Fix test when using an installed libc++
llvm-svn: 285392
2016-10-28 11:01:12 +00:00
Eric Fiselier 64428acf41 Add more tests for optional<const T>
llvm-svn: 285384
2016-10-28 06:40:29 +00:00
Eric Fiselier 761e42fa3d Add __libcpp_version file and __libcpp_library_version function.
This patch does two seperate things. First it adds a file called
"__libcpp_version" which only contains the current libc++ version
(currently 4000). This file is not intended for use as a header. This file
is used by Clang in order to easily determine the installed libc++ version.
This allows Clang to enable/disable certain language features only when the
library supports them.

The second change is the addition of _LIBCPP_LIBRARY_VERSION macro, which
returns the version of the installed dylib since it may be different than
the headers.

llvm-svn: 285382
2016-10-28 06:06:50 +00:00
Tim Shen e776667441 [libcxx] Make regex_match backtrack when search fails
Summary:
Fixes PR19851.
alg.re.match/ecma.pass.cpp still XFAILS on linux, but after commenting out
locale-related tests, it passes. I don't have a freebsd machine to produce a
full pass.

Reviewers: mclow.lists

Subscribers: cfe-commits, emaste

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

llvm-svn: 285352
2016-10-27 21:40:34 +00:00
Stephan T. Lavavej 50b80c36fa [PATCH] D25483: [libcxx] [test] Fix non-Standard assumptions about how many elements are allocated
llvm-svn: 285346
2016-10-27 21:25:12 +00:00
Casey Carter be65b24a55 Cleanup nonportable behavior in tests for std::any
Fixes MS issues 63, 64, and 65.

test/std/utilities/any/any.class/any.cons/move.pass.cpp:
* "Moves are always destructive" is not a portable assumption; check with LIBCPP_ASSERT.

test/std/utilities/any/any.class/any.cons/value.pass.cpp:
* The standard does not forbid initializing std::any from any pointer-to-function type. Remove the non-conforming "DecayTag" test.

test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp:
* Self-swap is not specified to perform no moves; check with LIBCPP_ASSERT.

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

llvm-svn: 285234
2016-10-26 20:18:13 +00:00
Casey Carter 9450d5e262 Silence unused parameter warnings in archetypes.hpp
Reviewed at: https://reviews.llvm.org/D25958

llvm-svn: 285213
2016-10-26 17:22:25 +00:00
Eric Fiselier 8f29ea36c3 Fix nullptr tests
llvm-svn: 285117
2016-10-25 20:45:17 +00:00
Eric Fiselier a905007f12 Fix non-portable tests for temp_directory_path(...)
llvm-svn: 285020
2016-10-24 20:40:35 +00:00
Eric Fiselier 4d4c79d8f5 Add missing include in string_view tests. Patch from Billy ONeil @ microsoft
llvm-svn: 285012
2016-10-24 20:11:17 +00:00
Eric Fiselier 009fb08d14 Fix shadow warnings in string_view tests. Patch from STL@microsoft.com
llvm-svn: 285011
2016-10-24 20:10:00 +00:00
Eric Fiselier d11fdad33e Backout enabling -Wshadow until I have time to fix the breakage
llvm-svn: 284952
2016-10-23 22:24:11 +00:00
Eric Fiselier 81a09f2c9e Fix libc++ specific assertion in permissions(...) tests
llvm-svn: 284945
2016-10-23 19:14:58 +00:00
Eric Fiselier b51325cefe Turn on -Wshadow so I find occurances before STL does
llvm-svn: 284944
2016-10-23 19:01:10 +00:00
Eric Fiselier 1e96d5380e Make make_from_tuple tests more portable. Patch from STL@microsoft.com
llvm-svn: 284943
2016-10-23 18:55:51 +00:00
Eric Fiselier eca753ad92 Fix unreferenced parameters. Patch from STL@microsoft.com
llvm-svn: 284942
2016-10-23 18:52:58 +00:00
Eric Fiselier d06ee7706c Fix shadowing warning. Patch from STL@microsoft.com
llvm-svn: 284941
2016-10-23 18:47:58 +00:00
Tim Shen abd1a6e687 [libcxx] Support std::regex_constants::match_not_null
Summary: Fixes PR21597.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 284881
2016-10-21 20:41:47 +00:00
Marshall Clow c1b73a1793 Adding a missing constexpr test for reverse_iterator operator[].
llvm-svn: 284731
2016-10-20 14:57:34 +00:00
Eric Fiselier db94496629 Attempt to workaround XPASS for aligned allocation tests
llvm-svn: 284691
2016-10-20 03:31:07 +00:00
Marshall Clow 1b8f260ed9 Implement constexpr support for reverse_iterator. Reviewed as https://reviews.llvm.org/D25534
llvm-svn: 284602
2016-10-19 15:12:50 +00:00
Eric Fiselier c5777f4d58 Make any_cast<void()>(nullptr) compile
llvm-svn: 284333
2016-10-16 11:56:38 +00:00
Eric Fiselier f72aaff994 Update LWG 2767 and add test case
llvm-svn: 284324
2016-10-16 03:45:06 +00:00
Eric Fiselier 015fcffd57 Update status for std::optional LWG issues and fix an optional SFINAE bug
llvm-svn: 284323
2016-10-16 03:21:35 +00:00
Eric Fiselier 50253ed1c6 Update issue status for LWG 2744
llvm-svn: 284322
2016-10-16 02:51:50 +00:00
Eric Fiselier 9c737fddba Update issue status for LWG 2768 and 2769
llvm-svn: 284321
2016-10-16 01:43:43 +00:00
Eric Fiselier ecafa8739e Implement LWG 2712 and update other issues status
llvm-svn: 284318
2016-10-16 00:47:59 +00:00
Eric Fiselier ae4c3e1699 Implement LWG 2681 and 2682
llvm-svn: 284316
2016-10-16 00:29:22 +00:00
Eric Fiselier 9ada18b339 Implement LWG 2672.
llvm-svn: 284314
2016-10-15 23:05:04 +00:00
Eric Fiselier 87ee8a0adb Implement modified LWG 2665
llvm-svn: 284313
2016-10-15 22:37:42 +00:00
Eric Fiselier bbcfec7edd Implement LWG2664 and update its status
llvm-svn: 284310
2016-10-15 21:29:44 +00:00
Eric Fiselier d2003575ce Prevent new/delete replacement tests from being optimized away.
llvm-svn: 284289
2016-10-14 22:47:08 +00:00
Eric Fiselier 797cb4f646 Clarify XFAIL comments
llvm-svn: 284282
2016-10-14 21:30:35 +00:00
Eric Fiselier 68696836d1 Work around Clang driver segfault when --coverage is used with -c and /dev/null
llvm-svn: 284225
2016-10-14 10:30:33 +00:00
Eric Fiselier 81b13934c1 XFAIL aligned allocation tests for older Clang versions
llvm-svn: 284214
2016-10-14 08:47:09 +00:00
Eric Fiselier 73bfe423fe XFAIL aligned allocation test failures with UBSAN
llvm-svn: 284210
2016-10-14 07:49:15 +00:00
Eric Fiselier 498ee00a3a Add void_t and invoke feature test macros
llvm-svn: 284209
2016-10-14 07:19:52 +00:00
Eric Fiselier 0ae4f23fdc Implement P0035R4 -- Add C++17 aligned allocation functions
Summary:
This patch implements the library side of P0035R4. The implementation is thanks to @rsmith.

In addition to the C++17 implementation, the library implementation can be explicitly turned on using `-faligned-allocation` in all dialects.


Reviewers: mclow.lists, rsmith

Subscribers: rsmith, cfe-commits

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

llvm-svn: 284206
2016-10-14 06:46:30 +00:00
Marshall Clow 6ecac73019 Implement http://wg21.link/p0302r1: Removing Allocator Support in std::function. These functions never worked, and as far as I know, no one ever called them.
llvm-svn: 284164
2016-10-13 21:06:03 +00:00
Marshall Clow bb1db210a8 Add missing include in test; NFC. Thanks to Jonathan Wakely for the report.
llvm-svn: 284120
2016-10-13 13:21:38 +00:00
Dimitry Andric ca2ab4f657 Disable trivial pair copy/move tests when unsupported
Summary:
On FreeBSD, for ABI compatibility reasons, the pair trivial copy
constructor is disabled, using the aptly-named
`_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR` define.

Disable the related tests when this define is on, so they don't fail
unexpectedly.

Reviewers: emaste, rsmith, theraven, EricWF

Subscribers: cfe-commits

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

llvm-svn: 284047
2016-10-12 20:26:47 +00:00
Eric Fiselier a9fcc1d2a4 Correctly grant rebound limited_allocators friendship.
llvm-svn: 284006
2016-10-12 11:35:37 +00:00
Eric Fiselier 609fb0cc40 Remove incorrect XFAILS
llvm-svn: 284005
2016-10-12 11:29:18 +00:00
Eric Fiselier d2c71a923e Unbreak C++03 build
llvm-svn: 284004
2016-10-12 11:20:27 +00:00
Eric Fiselier 6b42540756 Remove usages of _LIBCPP_CONSTEXPR under test/std
llvm-svn: 284002
2016-10-12 10:28:09 +00:00
Eric Fiselier 6ce45e0840 Remove usages of _ALIGNAS_TYPE
llvm-svn: 283999
2016-10-12 10:19:48 +00:00
Eric Fiselier 1b9327f332 support --param=std=gnu++XX
llvm-svn: 283997
2016-10-12 09:53:35 +00:00
Eric Fiselier 1c3203a2c1 Fix more C++11 constexpr issues in the tests
llvm-svn: 283996
2016-10-12 09:48:44 +00:00
Eric Fiselier 883cc25d9f Fix nasty_containers.hpp for other stdlibs
llvm-svn: 283994
2016-10-12 09:31:26 +00:00
Eric Fiselier 9b480b07f9 Fix use of C++14 constexpr in C++11
llvm-svn: 283993
2016-10-12 09:20:58 +00:00
Eric Fiselier 5e931dd232 Remove use of _VSTD::__invoke in the not_fn tests
llvm-svn: 283991
2016-10-12 09:06:12 +00:00
Eric Fiselier 411e1f8288 Protect special members of NullBase archetype to avoid exposing them
llvm-svn: 283983
2016-10-12 08:09:22 +00:00
Eric Fiselier a9e659619f Implement N4606 optional
Summary:
Adapt implementation of Library Fundamentals TS optional into an implementation of N4606 optional.

  - Update relational operators per http://wg21.link/P0307
  - Update to requirements of http://wg21.link/P0032
  - Extension: Implement trivial copy/move construction/assignment for `optional<T>` when `T` is trivially copyable.

Audit P/Rs for optional LWG issues:
  - 2756 "C++ WP optional<T> should 'forward' T's implicit conversions" Implemented, which also resolves 2753 "Optional's constructors and assignments need constraints" (modulo my refusal to explicitly delete the move operations, which is a design error that I'm working on correcting in the 2756 P/R).
  - 2736 "nullopt_t insufficiently constrained" Already conforming. I've added a test ensuring that `nullopt_t` is not copy-initializable from an empty braced-init-list, which I believe is the root intent of the issue, to avoid regression.
  - 2740 "constexpr optional<T>::operator->" Already conforming.
  - 2746 "Inconsistency between requirements for emplace between optional and variant" No P/R, but note that the author's '"suggested resolution" is already implemented.
  - 2748 "swappable traits for optionals" Already conforming.
  - 2753 "Optional's constructors and assignments need constraints" Implemented.

Most of the work for this patch was done by Casey Carter @ Microsoft. Thank you Casey!



Reviewers: mclow.lists, CaseyCarter, EricWF

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

llvm-svn: 283980
2016-10-12 07:46:20 +00:00
Eric Fiselier fc647db3ee Revert Add <optional>. Will recommit with better commit message
llvm-svn: 283978
2016-10-12 06:48:31 +00:00
Eric Fiselier 6ee4001cc9 Add <optional> header.
This patch is largely thanks to Casey Carter @ Microsoft. He did the initial
work of porting our experimental implementation and tests over to namespace
std.

llvm-svn: 283977
2016-10-12 06:45:11 +00:00
Eric Fiselier 49a278fb6d Fix two more tests that hang when testing against libstdc++
llvm-svn: 283976
2016-10-12 04:56:23 +00:00
Eric Fiselier 76e316f995 Prevent the test suite from hanging when run against libstdc++
llvm-svn: 283975
2016-10-12 04:29:50 +00:00
Eric Fiselier e04aebe904 Add mork workarounds for running the test suite against libstdc++
llvm-svn: 283960
2016-10-12 00:28:14 +00:00
Eric Fiselier 612c00df31 Make it easier to run the libc++ test suite against libstdc++
llvm-svn: 283958
2016-10-12 00:00:37 +00:00
Eric Fiselier e6364a35fd Fix LWG2683 - filesystem::copy() should always clear the user-provided error_code
llvm-svn: 283951
2016-10-11 22:18:09 +00:00
Eric Fiselier 9595fb21dd Fix std::pair on FreeBSD
Summary:
FreeBSD ships an old ABI for std::pair which requires that it have non-trivial copy/move constructors. Currently the non-trivial copy/move is achieved by providing explicit definitions of the constructors. This is problematic because it means the constructors don't SFINAE properly. In order to SFINAE copy/move constructors they have to be explicitly defaulted and hense non-trivial.

This patch attempts to provide SFINAE'ing copy/move constructors for std::pair while still making them non-trivial. It does this by adding a base class with a non-trivial copy constructor and then allowing pair's constructors to be generated by the compiler. This also allows the constructors to be constexpr.


Reviewers: emaste, theraven, rsmith, dim

Subscribers: cfe-commits

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

llvm-svn: 283944
2016-10-11 21:22:21 +00:00
Eric Fiselier e778d10c0f Fix incorrect exception handling behavior in the uninitialized algorithms
llvm-svn: 283941
2016-10-11 21:13:44 +00:00
Marshall Clow 089d54b540 Add tests to check that swap(std::function, std::function) is noexcept. This is LWG#2062, but we already do this. No changes to the library, just adding tests.
llvm-svn: 283780
2016-10-10 16:47:48 +00:00
Marshall Clow 610ad3a598 Add tests for LWG2544. We already implement this; just adding tests to make sure that we keep doing it.
llvm-svn: 283749
2016-10-10 14:10:45 +00:00
Eric Fiselier ac473034fc Provide a constexpr addressof with GCC 7.
__builtin_addressof was added to the GCC trunk in the past week. This patch
teaches libc++ about it so it can correctly provide constexpr addressof.

Unfortunately this patch will break users of earlier GCC 7 builds, since
we expect __builtin_addressof but one won't be provided. One option would be
to only use __builtin_addressof for GCC 7.1 and above, but that means
waiting for another release.

Instead I've specifically chosen to break older GCC 7 versions. Since GCC 7
has yet to be released, and the 7.0 release is a development release, I
believe that anybody currently using GCC 7.0 will have no issue upgrading.

llvm-svn: 283715
2016-10-10 05:34:18 +00:00
Eric Fiselier 054fc4cef6 Fix linker script generation for in-tree builds
llvm-svn: 283700
2016-10-09 21:34:03 +00:00
Eric Fiselier f03ffb2c9b Remove all _LIBCPP_VERSION tests from under test/std
llvm-svn: 283644
2016-10-08 01:32:56 +00:00
Eric Fiselier e58baed3a3 Purge all usages of _LIBCPP_STD_VER under test/std/algorithm
llvm-svn: 283643
2016-10-08 01:25:23 +00:00
Eric Fiselier b10fc37096 Add missing <memory> include in test
llvm-svn: 283633
2016-10-08 00:59:16 +00:00
Eric Fiselier 653179b77b Add missing include in test_allocator.h
llvm-svn: 283632
2016-10-08 00:57:56 +00:00
Eric Fiselier 69a4f66114 [libc++] Fix stack_allocator
Summary:
To quote STL the problems with stack allocator are"

>"stack_allocator<T, N> is seriously nonconformant to N4582 17.6.3.5 [allocator.requirements].
> First, it lacks a rebinding constructor. (The nested "struct rebind" isn't sufficient.)
> Second, it lacks templated equality/inequality.
> Third, it completely ignores alignment.
> Finally, and most severely, the Standard forbids its existence. Allocators are forbidden from returning memory "inside themselves". This requirement is implied by the Standard's requirements for rebinding and equality. It's permitted to return memory from a separate buffer object on the stack, though."

This patch attempts to address all of those issues.

First, instead of storing the buffer inside the allocator I've change `stack_allocator` to accept the buffer as an argument.

Second, in order to fix rebinding I changed the parameter list from `<class T, size_t NumElements>` to `<class T, size_t NumBytes>`. This allows allocator rebinding
between types that have different sizes. 

Third, I added copy and rebinding constructors and assignment operators.

And finally I fixed the allocation logic to always return properly aligned storage.



Reviewers: mclow.lists, howard.hinnant, STL_MSFT

Subscribers: cfe-commits

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

llvm-svn: 283631
2016-10-08 00:56:22 +00:00
Eric Fiselier 609e669e1a Fix shadow warnings. Patch from STL@microsoft.com
llvm-svn: 283618
2016-10-07 22:10:35 +00:00
Eric Fiselier b18fd9654f Fix various issues in std::any and the related tests.
* Fix self-swap. Patch from Casey Carter.

* Remove workarounds and tests for types with deleted move constructors. This
  was originally added as part of a LWG proposed resolution that has since
  changed.

* Re-apply most recent PR for LWG 2769.

* Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to
  use the decayed type.

* Fix tests to allow moved-from std::any's to have a non-empty state. This is
  the behavior of MSVC's std::any.

* Various whitespace and test fixes.

llvm-svn: 283606
2016-10-07 21:27:45 +00:00
Eric Fiselier 89c9191447 Remove MSVC workarounds. Patch from STL@microsoft.com
llvm-svn: 283580
2016-10-07 18:51:33 +00:00
Asiri Rathnayake 08eb2148ff [libcxx] Recover no-exceptions XFAILs - I
First batch of changes to get some of these XFAILs working in the
no-exceptions libc++ variant.

Changed some XFAILs to UNSUPPORTED where the test is all about exception
handling. In other cases, used the test macros TEST_THROW and
TEST_HAS_NO_EXCEPTIONS to conditionally exclude those parts of the test
that concerns exception handling behaviour.

Reviewers: EricWF, mclow.lists

Differential revision: https://reviews.llvm.org/D24562

llvm-svn: 283441
2016-10-06 11:15:41 +00:00
Marshall Clow 23c725ebdf Comment out failing test while I figure out who is at fault
llvm-svn: 283360
2016-10-05 18:47:18 +00:00
Marshall Clow d836a9d5f1 Make tests for is_empty better. No functional change.
llvm-svn: 283339
2016-10-05 17:01:16 +00:00
Marshall Clow 67be6ff839 Add another append test for basic_string
llvm-svn: 283331
2016-10-05 15:47:13 +00:00
Eric Fiselier 015839a555 [libcxx] [test] Guard __has_include usage with a macro
Summary: There's a macro scheme already being used for __has_feature etc. Use it for __has_include too, which makes MSVC happy (it doesn't support __has_include yet, and unguarded use explodes horribly).

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 283260
2016-10-04 21:25:51 +00:00
Marshall Clow 53abcbd8a9 Add tests to make sure that is_constructible<cv-void> is false. We already checked 'unqualified void'. This was brought up by LWG#2738
llvm-svn: 283161
2016-10-03 23:39:52 +00:00
Logan Chien 45e8ba88c3 [lit] Allow more file extensions for test cases.
This commit splits the file extensions before determining the test
format.  This allows libc++abi to add assembly-based test cases.

llvm-svn: 283118
2016-10-03 16:00:22 +00:00
Eric Fiselier 2c8c71f13e Remove all instances of _LIBCPP_HAS_NO_RVALUE_REFERENCES from test/std/utilities
llvm-svn: 283032
2016-10-01 10:46:01 +00:00
Eric Fiselier f18891050b Replace test_throw.h header with a single test macro
llvm-svn: 283030
2016-10-01 10:34:13 +00:00
Eric Fiselier c24e6dd3c8 [libc++] Extension: Make `move` and `forward` constexpr in C++11.
Summary:
`std::move` and `std::forward` were not marked constexpr in C++11.  This can be very damaging because it makes otherwise constant expressions non-constant. For example:

```
#include <utility>
template <class T>
struct Foo {
  constexpr Foo(T&& tx) :  t(std::move(tx)) {}
  T t;
};
[[clang::require_constant_initialization]] Foo<int> f(42); // Foo should be constant initialized but C++11 move is not constexpr. As a result `f` is an unsafe global.
```

This patch applies `constexpr` to `move` and `forward` as an extension in C++11. Normally the library is not allowed to add `constexpr` because it may be observable to the user. In particular adding constexpr may cause valid code to stop compiling. However these problems only happen in more complex situations, like making `__invoke(...)` constexpr. `forward` and `move` are simply enough that applying `constexpr` is safe. 

Note that libstdc++ has offered this extension since at least 4.8.1.

Most of the changes in this patch are simply test cleanups or additions. The main changes in the tests are:

* Fold all `forward_N.fail.cpp` tests into a single `forward.fail.cpp` test using -verify.
* Delete most `move_only_N.fail.cpp` tests because they weren't actually testing anything.
* Fold `move_copy.pass.cpp` and `move_only.pass.cpp` into a single `move.pass.cpp` test.
* Add return type and noexcept tests for `forward` and `move`.




Reviewers: rsmith, mclow.lists, EricWF

Subscribers: K-ballo, loladiro

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

llvm-svn: 282439
2016-09-26 20:55:02 +00:00
Eric Fiselier 221f689f3b Update -verify test to use new static assert message
llvm-svn: 282352
2016-09-25 08:30:05 +00:00
Eric Fiselier 54613ab4d4 [libc++] Remove various C++03 feature test macros
Summary:
Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`.

This patch removes the __config macros:

* _LIBCPP_HAS_NO_TRAILING_RETURN
* _LIBCPP_HAS_NO_TEMPLATE_ALIASES
* _LIBCPP_HAS_NO_ADVANCED_SFINAE
* _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
* _LIBCPP_HAS_NO_STATIC_ASSERT

As a drive I also changed our C++03 static_assert to use _Static_assert if available.

I plan to commit this without review if nobody voices an objection.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 282347
2016-09-25 03:34:28 +00:00
Marshall Clow a8fd1e4be0 Fix a few static_asserts that need extra parens on -03
llvm-svn: 282343
2016-09-24 23:52:21 +00:00
Marshall Clow 54f0981ebd Implement proposed resolution for LWG#2758. Reviewed as D24446. Normally, I would wait for these to be voted upon at a committee meeting (November), but the current draft standard is broken, and this should fix it. (And if it doesn't, we want to know about it soonest)
llvm-svn: 282342
2016-09-24 22:45:42 +00:00
Marshall Clow 450370f3c8 Fix incorrect include in is_error_code_enum.pass.cpp
llvm-svn: 282332
2016-09-24 18:16:53 +00:00
Marshall Clow e69a08ba6d Implement is_error_code_v and is_error_condition_v for c++17. Rework the tests for is_error_code and is_error_condition, since they were really lacking. Thanks to Alisdair for the heads-up that we were missing these.
llvm-svn: 282331
2016-09-24 17:36:14 +00:00
Marshall Clow c669522a26 Fix failure on 03 bot
llvm-svn: 282134
2016-09-22 03:25:22 +00:00
Marshall Clow a48055cee3 Add missing _v traits. is_bind_expression_v, is_placeholder_v and uses_allocator_v
llvm-svn: 282126
2016-09-22 00:23:15 +00:00
Asiri Rathnayake a6199170ac [libcxx] Add missing c++98 xfail. NFC.
This is the only test failing in c++98 mode at the moment.

llvm-svn: 281731
2016-09-16 14:32:19 +00:00
Kuba Brecka 50bc34ca31 [libcxx] Allow sanitizing libcxx with ASan+UBSan simultaneously
Allow building with LLVM_USE_SANITIZER=“Address;Undefined” (and “Undefined;Address”).

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

llvm-svn: 281603
2016-09-15 11:04:53 +00:00
Kuba Brecka f239e6b7a2 [libcxx] Add a TSan regression test for a data race in call_once
Differential Revision: https://reviews.llvm.org/D24297

llvm-svn: 281477
2016-09-14 14:15:42 +00:00
Kuba Brecka eec85de4c0 [libcxx] Fix a typo in test/libcxx/test/target_info.py that prevents running tests on Darwin with sanitizers
Differential Revision: https://reviews.llvm.org/D24297

llvm-svn: 281476
2016-09-14 14:13:50 +00:00
Asiri Rathnayake 8c2bf45da9 [libcxx] Introduce an externally-threaded libc++ variant.
This patch further decouples libc++ from pthread, allowing libc++ to be built
against other threading systems. There are two main use cases:

- Building libc++ against a thread library other than pthreads.

- Building libc++ with an "external" thread API, allowing a separate library to
  provide the implementation of that API.

The two use cases are quite similar, the second one being sligtly more
de-coupled than the first. The cmake option LIBCXX_HAS_EXTERNAL_THREAD_API
enables both kinds of builds. One needs to place an <__external_threading>
header file containing an implementation of the "libc++ thread API" declared
in the <__threading_support> header.

For the second use case, the implementation of the libc++ thread API can
delegate to a custom "external" thread API where the implementation of this
external API is provided in a seperate library. This mechanism allows toolchain
vendors to distribute a build of libc++ with a custom thread-porting-layer API
(which is the "external" API above), platform vendors (recipients of the
toolchain/libc++) are then required to provide their implementation of this API
to be linked with (end-user) C++ programs.

Note that the second use case still requires establishing the basic types that
get passed between the external thread library and the libc++ library
(e.g. __libcpp_mutex_t). These cannot be opaque pointer types (libc++ sources
won't compile otherwise). It should also be noted that the second use case can
have a slight performance penalty; as all the thread constructs need to cross a
library boundary through an additional function call.

When the header <__external_threading> is omitted, libc++ is built with the
"libc++ thread API" (declared in <__threading_support>) as the "external" thread
API (basic types are pthread based). An implementation (pthread based) of this
API is provided in test/support/external_threads.cpp, which is built into a
separate DSO and linked in when running the libc++ test suite. A test run
therefore demonstrates the second use case (less the intermediate custom API).

Differential revision: https://reviews.llvm.org/D21968

Reviewers: bcraig, compnerd, EricWF, mclow.lists
llvm-svn: 281179
2016-09-11 21:46:40 +00:00
Eric Fiselier 94b812ac77 Avoid compile error by giving the test type a user defined default constructor
llvm-svn: 280780
2016-09-07 03:50:36 +00:00
Marshall Clow a77bb8ef34 Fix PR#30303 - no matching function for call to '__ptr_in_range'
llvm-svn: 280779
2016-09-07 03:32:06 +00:00
Eric Fiselier f8e7a54be8 Improve constexpr tests for std::any
llvm-svn: 280777
2016-09-07 02:38:48 +00:00
Eric Fiselier c1d527d3d8 Fix PR30260 - optional<const T> not working.
This patch fixes PR30260 by using a (void*) cast on the placement argument
to placement new to casts away the const. See also http://llvm.org/PR30260.

As a drive by change this patch also changes the header guard for
<experimental/optional> to _LIBCPP_EXPERIMENTAL_OPTIONAL from _LIBCPP_OPTIONAL.

llvm-svn: 280775
2016-09-07 01:56:07 +00:00
Marshall Clow 7e1a23001d Fix Bug 30240 - std::string: append(first, last) error when aliasing. Add test cases for append/insert/assign/replace while we're at it, and fix a similar bug in insert.
llvm-svn: 280643
2016-09-05 01:54:30 +00:00
Eric Fiselier 8e571b551e Apply curr_symbol.pass.cpp test fix to missed test case
llvm-svn: 280612
2016-09-04 04:09:25 +00:00
Eric Fiselier f49fe8f2b6 Fix bad locale test data when using the newest glibc
llvm-svn: 280608
2016-09-04 00:48:54 +00:00
Marshall Clow 2a837eae39 Mark test as XFAIL for C++03, rather than providing a dummy pass.
llvm-svn: 280605
2016-09-04 00:37:06 +00:00
Eric Fiselier ff94d25063 Fix PR30202 - notify_all_at_thread_exit seg faults if run from a raw pthread context.
Summary:
This patch allows threads not created using `std::thread` to use `std::notify_all_at_thread_exit` by ensuring the TL state has been initialized within `std::notify_all_at_thread_exit`.

Additionally this patch "fixes" a potential oddity in `__thread_local_pointer::reset(pointer)`, which would previously delete the old thread local data. However there should *never* be old thread local data because pthread *should* null it out on thread exit. Unfortunately it's possible that pthread failed to do this according to the spec:


> 
> Upon key creation, the value NULL shall be associated with the new key in all active threads. Upon thread creation, the value NULL shall be associated with all defined keys in the new thread.
> 
> An optional destructor function may be associated with each key value. At thread exit, if a key value has a non-NULL destructor pointer, and the thread has a non-NULL value associated with that key, the value of the key is set to NULL, and then the function pointed to is called with the previously associated value as its sole argument. The order of destructor calls is unspecified if more than one destructor exists for a thread when it exits.
> 
> If, after all the destructors have been called for all non-NULL values with associated destructors, there are still some non-NULL values with associated destructors, then the process is repeated. If, after at least {PTHREAD_DESTRUCTOR_ITERATIONS} iterations of destructor calls for outstanding non-NULL values, there are still some non-NULL values with associated destructors, implementations may stop calling destructors, or they may continue calling destructors until no non-NULL values with associated destructors exist, even though this might result in an infinite loop.

However if pthread fails to delete the value it is probably incorrect for us to do it. Destroying the value performs all of the "at thread exit" actions registered with it but we are way past "at thread exit".





Reviewers: mclow.lists, bcraig, EricWF

Subscribers: cfe-commits

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

llvm-svn: 280588
2016-09-03 08:07:40 +00:00
Eric Fiselier ea982ed35a Add "FLAKY_TEST" test directive to support re-running flaky tests.
Some of the mutex tests fail on machines with high load. This patch implements
the test directive "// FLAKY_TEST" which allows a test to be run 3 times
before it's considered a failure.

llvm-svn: 280050
2016-08-30 01:46:43 +00:00
Eric Fiselier 4268a742f5 Fix pair::operator=(TupleLike&&).
This assignment operator was previously broken since the SFINAE always resulted
in substitution failure. This caused assignments to turn into
copy construction + assignment.

This patch was originally committed as r279953 but was reverted due to warnings
in the test-suite. This new patch corrects those warnings.

llvm-svn: 279955
2016-08-29 01:43:41 +00:00
Eric Fiselier 67c2344174 Revert r279953 - Fix pair::operator=(TupleLike&&)
The test emits warnings causing the test-suite to fail. Since I want this
patch merged into 3.9 I'll recommit it with a clean test.

llvm-svn: 279954
2016-08-29 01:39:54 +00:00
Eric Fiselier 0678cc793a Fix pair::operator=(TupleLike&&).
This assignment operator was previously broken since the SFINAE always resulted
in substitution failure. This caused assignments to turn into
copy construction + assignment.

llvm-svn: 279953
2016-08-29 01:09:47 +00:00
Eric Fiselier e7154709e0 Implement C++17 std::sample.
This patch implements the std::sample function added to C++17 from LFTS. It
also removes the std::experimental::sample implementation which now forwards
to std::sample.

llvm-svn: 279948
2016-08-28 22:14:37 +00:00
Eric Fiselier 040411762f Mark LWG 2716 as complete - shuffle and sample disallows lvalue URNGs.
Libc++'s implementation of shuffle and sample already support lvalue and rvalue
RNG's. This patch adds tests for both categories and marks the issue as complete.

This patch also contains drive-by change for std::experimental::sample which
improves the diagnostics produced when the correct iterator categories are
not supplied.

llvm-svn: 279947
2016-08-28 21:55:00 +00:00
Eric Fiselier 2fc65041be Implement LWG 2711. Constrain path members.
llvm-svn: 279945
2016-08-28 21:26:01 +00:00
Chris Bieneman f17227a1da [CMake] Be more consistent about naming targets and components
Summary:
The point of this patch is to have a consistent convention for naming build, check and install targets so that the targets can be constructed from the project name.

This change renames a bunch of CMake components and targets from libcxx to cxx. For each renamed target I've added a convenience target that matches the old target name and depends on the new target. This will preserve function of the old targets so that the change doesn't break the world. We can evaluate if it is worth removing the extra targets later.

Reviewers: EricWF

Subscribers: cfe-commits

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

llvm-svn: 279675
2016-08-24 22:17:06 +00:00
Adhemerval Zanella 9704d235d0 libcxx: Fix libcxx tests on aarch64 with libunwind
Some tests uses 'long double' to/from conversions and for some targets
they are provided by compiler runtime (either compiler-rt or libgcc).
However when building libcxx with linunwinder current test configuration
at target_info.py do not include the required libraries, as:

  not llvm_unwinder:
    "-lc++" "-lm" "-lgcc_s" "-lgcc" "-lpthread" "-lc" "-lgcc_s" "-lgcc"

  llvm_unwinder
    "-lc++" "-lm" "-lpthread" "-lc" "-lunwind" "-ldl"

This causes some tests build issues with missing symbols on aarch64,
for instance, where 'long double' is a binary float with 128-bits with
mostly of internal operations being provided by software routines.

This patch changes how to define the default linker flags with libunwinder by
adding libgcc regardless.

I checked and aarch64 and x86_64 with libcxx and libunwind (with and without
LIBCXXABI_USE_LLVM_UNWINDER).

llvm-svn: 279552
2016-08-23 19:25:12 +00:00
Marshall Clow 3820ac3106 Add missing include that caused a test failure on Windows. Thanks to STL for the patch. No functional change.
llvm-svn: 279453
2016-08-22 18:45:31 +00:00
Chris Bieneman 12b134bd4b [CMake] Get libcxx building under LLVM/runtimes
Summary:
The new LLVM runtimes build directory requires some basic conventions across the runtime projects. These changes make libcxx build under the runtimes subdirectory. The general idea of the changes is that the runtimes subdirectory requires some conventions to be consistent across runtime projects.

I expect to have a few more small patches that build on this to tie up check targets and other things useful in development workflows.

Summary of changes in this patch:

* Renamed variable LLVM_CONFIG -> LLVM_CONFIG_PATH
* Renamed variable LIBCXX_BUILT_STANDALONE -> LIBCXX_STANDALONE_BUILD
* Add an include of AddLLVM in the tests subdirectory for add_lit_testsuite.

Reviewers: EricWF

Subscribers: cfe-commits

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

llvm-svn: 279151
2016-08-18 21:31:51 +00:00
Marshall Clow d4e8659dfc make the associative containers do the right thing for propogate_on_container_assignment. Fixes bug #29001. Tests are only for <map> right now - more complete tests will come when we revamp our allocator testing structure.
llvm-svn: 279008
2016-08-17 23:24:02 +00:00
Marshall Clow 2a10c960fa Support allocators with explicit conversion constructors. Fixes bug #29000
llvm-svn: 278904
2016-08-17 05:58:40 +00:00
Adhemerval Zanella ced7928069 libcxx: Fix path.compare.pass expected result
The expected 'filesystem::path::compare' result states that for different
path only result sign contains the information about passed arguments
(not its integer value).  This is due it uses the output of other compare
functions (basic_string_view and char_traits) without further handling and
char_traits uses memcmp for final buffer comparison.

However for GLIBC on AArch64 the code:

  int ret = memcmp ("b/a/c", "a/b/c", 1);

Results in '64' where for x86_64 it results in '1'.

This patch fixes the expected 'filesystem::path::compare' by normalizing
all the results before assert comparison.

llvm-svn: 278745
2016-08-15 21:24:50 +00:00
Eric Fiselier 5f6100260b Fix new ASAN failures
llvm-svn: 278736
2016-08-15 20:50:01 +00:00
Eric Fiselier d9ce291739 Use -O1 when testing with ASAN and MSAN to prevent Clang OOM errors.
Currently certain tests get killed when compiled with ASAN at -O0 because
they eat all of the systems memory. This doesn't happen at -O1, so enable that
to work around the issue.

llvm-svn: 278722
2016-08-15 19:37:20 +00:00
Marshall Clow 82b16766e6 Remove test for the sign of a NaN - doesn't work on MIPS, not strictly legal. Fixes bug 28936
llvm-svn: 278387
2016-08-11 18:46:24 +00:00
Saleem Abdulrasool f5b8d8249e test: relax the FS test a slight bit to be more reliable
Some filesystems track atime always.  This relaxes the test to accept either a
filesystem which does not accurately track atime or does track the atime
accurately.  This allows the test to pass on filesystems mounted with
`strictatime` on Linux or on macOS.

llvm-svn: 278357
2016-08-11 16:58:12 +00:00
Eric Fiselier f5feedfa8b Unbreak C++03 build.
llvm-svn: 278323
2016-08-11 08:15:35 +00:00
Eric Fiselier a3e11a5b15 Refactor test archetypes implementation.
llvm-svn: 278319
2016-08-11 07:04:14 +00:00
Eric Fiselier 18dd773016 Add missing REQUIRES for C++14
llvm-svn: 278311
2016-08-11 03:33:41 +00:00
Eric Fiselier 324506b9f3 [libcxx] Add std::any
Summary:
This patch adds std::any by moving/adapting <experimental/any>.

This patch also implements the std::any parts of p0032r3 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0032r3.pdf)
and LWG 2509 (http://cplusplus.github.io/LWG/lwg-defects.html#2509).

I plan to push it in a day or two if there are no comments.


Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 278310
2016-08-11 03:13:11 +00:00
Eric Fiselier 45b7b44867 Implement LWG 2148: Make non-enum default hash specialization well-formed
Summary:
This patch removes the static_assert for non-enum types in the primary hash template. Instead non-enum types create a hash<T> specialization that is not constructible nor callable.

See also:
  * http://cplusplus.github.io/LWG/lwg-active.html#2543
  * https://llvm.org/bugs/show_bug.cgi?id=28917

Reviewers: mclow.lists, EricWF

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 278300
2016-08-10 22:45:26 +00:00
Marshall Clow 7725546a32 std:: quailfy the calls for cend/crend/cbegin/cend. Fixes bug 28927.
llvm-svn: 278282
2016-08-10 20:04:46 +00:00
Matthias Braun 852f990ecb test/hard_link_count(): Fix test on darwin
The hard link count that stat reports are different between normal hfs and the
case sensitive variant. Accept both.

llvm-svn: 278191
2016-08-10 01:02:28 +00:00
Eric Fiselier 1d711627b4 Fix copy/move constructor annotation for the uses-allocator test types.
Previously the copy/move constructors of the test types did not
properly set the arg_id to T const& or T&& respectivly.

llvm-svn: 277970
2016-08-08 02:22:41 +00:00
Hubert Tong 2fdf202493 [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctor
Summary:
The synopsis in C++11 subclause 28.8 [re.regex] has:
```
basic_regex(const charT* p, size_t len,
            flag_type f = regex_constants::ECMAScript);
```

The default argument is added to libc++ by this change.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

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

Reapplies r277966.
Patch by Jason Liu!

llvm-svn: 277968
2016-08-07 22:26:04 +00:00
Hubert Tong faf3149df6 Revert r277966. Forgot patch attribution.
llvm-svn: 277967
2016-08-07 22:23:24 +00:00
Hubert Tong 614c406f9e [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctor
Summary:
The synopsis in C++11 subclause 28.8 [re.regex] has:
```
basic_regex(const charT* p, size_t len,
            flag_type f = regex_constants::ECMAScript);
```

The default argument is added to libc++ by this change.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

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

llvm-svn: 277966
2016-08-07 22:18:33 +00:00
Eric Fiselier 296d9c79f5 Fix compile error due to mismatched iterator types. Patch from STL@microsoft.com
llvm-svn: 277574
2016-08-03 05:50:03 +00:00
Eric Fiselier 9b32bfb651 Fix an MSVC x64 compiler warning. Patch from STL@microsoft.com
llvm-svn: 277573
2016-08-03 05:48:09 +00:00
Eric Fiselier 7da93bb154 Silence another occurrence of MSVC's suprious unused warning. Patch from STL@microsoft.com
llvm-svn: 277572
2016-08-03 05:46:36 +00:00
Hubert Tong ac98d59802 [libcxx] basic_regex: add traits_type, string_type
Summary:
In the synopsis in C++11 subclause 28.8 [re.regex], `basic_regex` is
specified to have member typedefs `traits_type` and `string_type`. This
change adds them to libc++.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

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

Patch by Jason Liu!

llvm-svn: 277526
2016-08-02 21:34:48 +00:00
JF Bastien 8a63138ebc NFC: fix typo
llvm-svn: 277404
2016-08-01 23:34:29 +00:00
JF Bastien 0f81478c7c atomics.align: XFAIL GCC
It currently fails because GCC changed the mangling of templates, which affects std::atomic using __attribute__((vector(X))). The bot using GCC 4.9 generates the following message:

In file included from /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/test/libcxx/atomics/atomics.align/align.pass.sh.cpp:24:0:
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic: In instantiation of 'atomic_test<T>::atomic_test() [with T = __vector(2) int]':
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/test/libcxx/atomics/atomics.align/align.pass.sh.cpp:66:3:   required from here
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: error: 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(2) int]' conflicts with a previous declaration
     __gcc_atomic_t() _NOEXCEPT = default;
     ^
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: previous declaration 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(1) int]'
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: error: 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(2) int]' conflicts with a previous declaration
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: previous declaration 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(1) int]'
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:939:5: note: synthesized method 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(2) int]' first required here
     __atomic_base() _NOEXCEPT = default;
     ^

GCC's docs say the following about ABI version 6:
Version 6, which first appeared in G++ 4.7, corrects the promotion behavior of C++11 scoped enums and the mangling of template argument packs, const/static_cast, prefix ++ and –, and a class scope function used as a template argument.

llvm-svn: 277380
2016-08-01 20:28:13 +00:00
JF Bastien a2b1c14911 libc++: test lock-free atomic alignment
Summary:
libc++ implements std::atomic<_Tp> using __atomic_base<_Tp> with
`mutable _Atomic(_Tp) __a_`. That member must be suitably aligned on
relevant ISAs for instructions such as cmpxchg to work properly, but
this alignment isn't checked anywhere. __atomic_base's implementation
relies on _Atomic doing "the right thing" since it's under the
compiler's control, and only the compiler knows about lock-freedom and
instruction generation. This test makes sure that the compiler isn't
breaking libc++'s expectations.

I'm looking at a few odd things in the C++ standard, and will have a few
other fixes around this area in the future.

This requires building with `-DLIBCXX_HAS_ATOMIC_LIB=True`, the test
marks the dependency as REQUIRES and won't be run without.

Reviewers: cfe-commits

Subscribers: EricWF, mclow.lists

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

llvm-svn: 277368
2016-08-01 19:27:08 +00:00