Commit Graph

918 Commits

Author SHA1 Message Date
Marshall Clow 4069c2bc48 Implement LWG#2761: 'basic_string should require that charT match traits::char_type'. Tests for string_view, too
llvm-svn: 297872
2017-03-15 18:41:11 +00:00
Mehdi Amini f8764e30d5 Add deployment knobs to tests (for Apple platforms)
The tests for libc++ specify -target on the command-line to the
compiler, but this is problematic for a few reasons.

Firstly, the -target option isn't supported on Apple platforms. Parts
of the triple get dropped and ignored. Instead, software should be
compiled with a combination of the -arch and -m<name>-version-min
options.

Secondly, the generic "darwin" target references a kernel version
instead of a platform version. Each platform has its own independent
versions (with different versions of libc++.1.dylib), independent of the
version of the Darwin kernel.

This commit adds support to the LIT infrastructure for testing against
Apple platforms using -arch and -platform options.

If the host is not on OS X, or the compiler type is not clang or apple-clang, then this commit has NFC.
If the host is on OS X and --param=target_triple=... is specified, then a warning is emitted to use arch and platform instead. Besides the warning, there's NFC.
If the host is on OS X and *no* target-triple is specified, then use the new deployment target logic. This uses two new lit parameters, --param=arch=<arch> and --param=platform=<platform>. <platform> has the form <name>[<version>].
By default, arch is auto-detected from clang -dumpmachine, and platform is "macosx".
If the platform doesn't have a version:
For "macosx", the version is auto-detected from the host system using sw_vers. This may give a different version than the SDK, since new SDKs can be installed on older hosts.
Otherwise, the version is auto-detected from the SDK version using xcrun --show-sdk-path.
-arch <arch> -m<name>-version-min=<version> is added to the compiler flags.
The target triple is computed as <arch>-apple-<platform>. It is *not* passed to clang, but it is available for XFAIL and UNSUPPORTED (as is with_system_cxx_lib=<target>).
For convenience, apple-darwin and <arch>-apple-darwin are added to the set of available features.
There were a number of tests marked to XFAIL on x86_64-apple-darwin11
and x86_64-apple-darwin12. I updated these to
x86_64-apple-macosx10.7 and x86_64-apple-macosx10.8.

llvm-svn: 297798
2017-03-15 00:59:54 +00:00
Billy Robert O'Neal III c32a1bdd5f Fixed unintentional assignment-in-assert in new "extending memory management tools" algorithms.
llvm-svn: 297772
2017-03-14 19:36:30 +00:00
Marshall Clow 55cfe4c16b Implement LWG2784, and mark 2786, 2795, 2804, 2812, 2826, 2834, 2837 and 2838 as complete - since we do them already
llvm-svn: 297752
2017-03-14 17:08:47 +00:00
Eric Fiselier bc9cbcedc1 Implement LWG 2787 - [file_status.cons] is inconsistent
llvm-svn: 297071
2017-03-06 21:02:06 +00:00
Mehdi Amini dff33c2760 Fix libc++ test to pass in C++03 mode
Was hitting: "error: scalar initializer cannot be empty"

llvm-svn: 296889
2017-03-03 17:24:29 +00:00
Eric Fiselier 4f73dbf403 Clean up more usages of _LIBCPP_HAS_NO_RVALUE_REFERENCES
llvm-svn: 296854
2017-03-03 03:43:25 +00:00
Eric Fiselier 412e9dbc60 Fix sign-compare warning in test; Oddly this only appears on OS X
llvm-svn: 296851
2017-03-03 02:02:07 +00:00
Eric Fiselier ae85a922d5 Work around test failure on 32 bit OS X
llvm-svn: 296840
2017-03-02 23:18:40 +00:00
Mehdi Amini 9a90c08a62 Fix libc++ test experimental/algorithms/alg.random.sample/sample.pass.cpp when ran in c++11 mode 32 bits
llvm-svn: 296830
2017-03-02 22:08:42 +00:00
Eric Fiselier 7709213ece Fix test failures caused by new/delete calls getting optimized away
llvm-svn: 296813
2017-03-02 21:16:35 +00:00
Eric Fiselier e2878b2f97 Remove more usages of REQUIRES-ANY in the test-suite
llvm-svn: 296727
2017-03-02 02:04:49 +00:00
Mehdi Amini 2f75ad4e51 Recommit r296712: "Fix Apple-specific XFAIL directive in libc++ test"
The test is passing with c++11 and c++14 but not c++1z on this
particular version of the compiler. Try to use lit boolean condition
to satisfy this constaint.

llvm-svn: 296725
2017-03-02 02:01:11 +00:00
Mehdi Amini cd0b56c5cf Revert "Fix Apple-specific XFAIL directive in libc++ test"
This reverts commit r296712. It broke our bot.

It turns out that the test is passing with c++11 and c++14 but
not c++1z on this particular version of the compiler. Since one
job is defaulting to c++1z and the other is testing all config I'm
not sure how to fix this...

llvm-svn: 296724
2017-03-02 01:57:40 +00:00
Mehdi Amini 48c4a82105 Fix Apple-specific XFAIL directive in libc++ test
This tests is failing in XCode 7.0. But Xcode 7.3 that shipped
an updated clang has this test passing. This is fixing green dragon
which runs this configuration.

llvm-svn: 296712
2017-03-01 23:45:03 +00:00
Mehdi Amini dc5474f800 Fix Apple-specific XFAIL directive in libc++ test
These tests are failing in XCode 8.0, 8.1, and 8.2, but not in Xcode
8.3. Annoyingly the version numbering for clang does not follow Xcode
and is bumped to 8.1 only in Xcode 8.3. So Xfailing apple-clang-8.0
should catch all cases here.

llvm-svn: 296704
2017-03-01 23:14:34 +00:00
Eric Fiselier 81529ba9ab Fix test failures due to bad test hasher
llvm-svn: 296568
2017-03-01 02:34:27 +00:00
Eric Fiselier 1ad881c3e4 Fix PR32097 - is_abstract doesn't work on class templates.
This patch fixes llvm.org/PR32097 by using the __is_abstract
builtin type-trait instead of the previous library-only implementation.

All supported compilers provide this trait. I've tested as far
back as Clang 3.2, GCC 4.6 and MSVC trunk.

llvm-svn: 296561
2017-03-01 01:27:14 +00:00
Michael Park 466f0653a3 Updated the XFAIL comment in variant tests.
Summary:
`ConstexprTestTypes::NoCtors` is an aggregate type (and consequently a literal type) in C++17,
but not in C++14 since it has a base class. This patch updates the comment to accurately describe the reason for the XFAIL.

Reviewers: EricWF

Reviewed By: EricWF

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

llvm-svn: 296558
2017-03-01 01:07:56 +00:00
Steven Wu 1f27eaf5aa Remove XFAIL in implicit_deduction_guides tests
The clang assertion causing these tests failing with sanitizer is fixed
in r295794. All the bots running libcxx tests should be upgraded and
running the compiler with the fix.

llvm-svn: 296385
2017-02-27 21:10:41 +00:00
Saleem Abdulrasool c409aa8a9e test: silence warnings on clang under clang-cl
When running under clang-cl mode, we do not define `__GNUC__`, resulting
in the test failing.

llvm-svn: 295560
2017-02-18 19:28:41 +00:00
Eric Fiselier 3c35491f02 Update all bug URL's to point to https://bugs.llvm.org/...
llvm-svn: 295434
2017-02-17 08:37:03 +00:00
Eric Fiselier c9d5da137d Remove dead code in test
llvm-svn: 295423
2017-02-17 07:00:04 +00:00
Eric Fiselier b6741d9695 add implicit deduction guide tests for string_view
llvm-svn: 295422
2017-02-17 06:59:11 +00:00
Eric Fiselier e427e4b81b Work around Clang assertion when testing C++17 deduction guides with '-g'.
llvm-svn: 295417
2017-02-17 05:04:09 +00:00
Eric Fiselier 2a1bfa98d1 [libcxx] Remove unexpected handlers in C++17
Summary:
This patch implements [P0003R5](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0003r5.html) which removes exception specifications from C++17.

The only changes to the library are removing `set_unexpected`, `get_unexpected`, `unexpected`, and `unexpected_handler`. These functions can be re-enabled in C++17 using `_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS`.

@mclow.lists what do you think about removing stuff is this way?

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: mclow.lists, cfe-commits

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

llvm-svn: 295406
2017-02-17 03:25:08 +00:00
Eric Fiselier dd3ba794ef [libc++] Fix PR 31938 - std::basic_string constructors use non-deductible parameter types.
Summary:
This patch fixes http://llvm.org/PR31938. The description below is copy/pasted from the bug:

The standard says:

template<class charT, class traits = char_traits<charT>,
         class Allocator = allocator<charT>>
class basic_string {
  using value_type = typename traits::char_type;
  // ...
  basic_string(const charT* s, const Allocator& a = Allocator());
};

libc++ actually chooses to declare the constructor as

  basic_string(const value_type* s, const Allocator& a = Allocator());

The implicit deduction guides from class template argument deduction make what was previously an implementation detail visible:

std::basic_string s = "foo"; // error, can't deduce charT.

The constructor in question is in the libc++ DSO, but fortunately it looks like fixing this will not result in an ABI break.


@rsmith How does this look? I did more than just the constructors mentioned in the PR, but IDK how far to take it.


Reviewers: mclow.lists, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, rsmith

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

llvm-svn: 295393
2017-02-17 01:17:10 +00:00
Eric Fiselier 57b93eb78f add tests for ENAMETOOLONG
llvm-svn: 295390
2017-02-17 01:00:37 +00:00
Eric Fiselier d5abcd1b2e Add tests for noexcept functions
llvm-svn: 294995
2017-02-13 22:44:39 +00:00
Saleem Abdulrasool b2684a52c6 test: use char32_t rather than wchar_t
wchar_t is not as portable as char32_t.  On Windows, wchar_t is
16-bytes and on Linux 32-bits.  The conversion to utf8 causes the
characters to exceed the limits on char16_t, resulting in tautological
comparisons.

llvm-svn: 294917
2017-02-12 21:42:35 +00:00
Saleem Abdulrasool 633c3b0756 test: mark requirement for pthread test
This test explicitly is checking the behaviour of std::thread and
pthread interactions.  This requires pthreads.  Add an appropriate
requirement.

llvm-svn: 294903
2017-02-12 17:37:48 +00:00
Saleem Abdulrasool 0d467ff53f test: squelch -Wreturn-type error
Add an unreachable marker to avoid a -Wreturn-type error when building
on Windows.

llvm-svn: 294901
2017-02-12 17:37:44 +00:00
Marshall Clow 3bc2e08429 Fix a bug I introduced in the tests for experimental::lcm and experimental::gcd.
llvm-svn: 294798
2017-02-10 22:44:14 +00:00
Marshall Clow 58fc1b50d8 Make lcm/gcd work better in edge cases. Fixes a UBSAN failure.
llvm-svn: 294779
2017-02-10 20:49:08 +00:00
Eric Fiselier a18ef6f1f9 Fix PR31916 - std::visit rejects visitors accepting lvalue arguments
A static assertion was misfiring since it checked
is_callable<Visitor, decltype(__variant_alt<T>.value)>. However
the decltype expression doesn't capture the value category as
required. This patch applies extra braces to decltype to fix
that.

llvm-svn: 294612
2017-02-09 19:01:22 +00:00
Michal Gorny f7132c83f1 [test] Fix hard_link_count test to account for fs with dir nlink==1
Filesystems are not required to maintain a hard link count consistent
with number of subdirectories. For example, on btrfs all directories
have nlink==1. Account for that in the test.

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

llvm-svn: 294431
2017-02-08 09:57:32 +00:00
Marshall Clow a2e54b632e Temporarily disable the LCM/GCD tests under UBSAN.
llvm-svn: 294417
2017-02-08 07:40:59 +00:00
Marshall Clow 4513057d66 Stop using random_shuffle in the libc++ test suite. It's going to be removed in c++17. Use shuffle() instead. No change to libc++, just the tests.
llvm-svn: 294328
2017-02-07 18:41:25 +00:00
Marshall Clow 7a1c0efff4 Add some tests to verify that we implement LWG#2837 correctly. No functional change.
llvm-svn: 294194
2017-02-06 16:03:23 +00:00
Eric Fiselier 9af60c4a8b Implement LWG 2773 - std::ignore should be constexpr.
In addition to the PR for LWG 2773 this patch also ensures
that each of std::ignores constructors or assignment operators
are constexpr.

llvm-svn: 294165
2017-02-06 01:25:31 +00:00
Stephan T. Lavavej 134ed9986a [libcxx] [test] Strip trailing whitespace.
No functional change, no code review.

llvm-svn: 294161
2017-02-05 22:48:27 +00:00
Stephan T. Lavavej 881d861346 [libcxx] [test] Fix comment typos.
No functional change, no code review.

llvm-svn: 294160
2017-02-05 22:48:20 +00:00
Stephan T. Lavavej ae2798fc53 [libcxx] [test] Avoid MSVC's non-Standard ABI in underlying_type.pass.cpp.
When compiled with Clang for Windows, this was emitting "enumerator value
evaluates to 4294967295, which cannot be narrowed to type 'int' [-Wc++11-narrowing]".

The test should more strenuously avoid poking this ABI deficiency (and it
already has coverage for explicitly specified underlying types).

Fixes D29140.

llvm-svn: 294159
2017-02-05 22:48:13 +00:00
Stephan T. Lavavej 0d6482f3bb [libcxx] [test] Fix Clang -Wpessimizing-move "moving a temporary object prevents copy elision".
N4618 30.6.6 [futures.unique_future]/12 declares "shared_future<R> share() noexcept;".

Fixes D29139.

llvm-svn: 294158
2017-02-05 22:48:07 +00:00
Stephan T. Lavavej 8bb0ffb072 [libcxx] [test] Fix Clang -Wunused-local-typedef, part 3/3.
test/std/strings/string.classes/typedefs.pass.cpp
Actually test what basic_string's typedefs stand for.

test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
NotDerived and ND were completely unused.

test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
P2 was mistakenly not being used. Yes, that's
right: -Wunused-local-typedef CAUGHT A MISTAKE! AMAZING!

Fixes D29137.

llvm-svn: 294156
2017-02-05 22:47:54 +00:00
Stephan T. Lavavej 50bd9576f0 [libcxx] [test] Fix Clang -Wunused-local-typedef, part 2/3.
These typedefs were completely unused.

Fixes D29136.

llvm-svn: 294155
2017-02-05 22:47:41 +00:00
Stephan T. Lavavej 03fe6e2da2 [libcxx] [test] Fix Clang -Wunused-local-typedef, part 1/3.
Guard typedefs and static_asserts with _LIBCPP_VERSION.

test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
Additionally deal with conditional compilation.

test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
Additionally deal with typedefs used by other typedefs.

Fixes D29135.

llvm-svn: 294154
2017-02-05 22:47:09 +00:00
Marshall Clow e29b1ed50b Change the base class of std::bad_optional_access. This is a (subtle) ABI change, and is in response to http://http://wg21.link/LWG2806, which I *expect* to be adopted in Kona. I am making this change now in anticipation, and will get it into 4.0, because (a) 4.0 is the first release with std::optional, and (b) I don't want to make an ABI-change later, when the user base should be significantly larger. Note that I didn't change std::experimental::bad_optional_access, because that's still specified to derive from std::logic_error.
llvm-svn: 294133
2017-02-05 20:06:38 +00:00
Saleem Abdulrasool 2f7ceb120e filesystem: fix n4100 conformance for `temp_directory_path`
N4100 states that an error shall be reported if
`!exists(p) || !is_directory(p)`.  We were missing the first half of the
conditional.  Invert the error and normal code paths to make the code
easier to follow.

llvm-svn: 294127
2017-02-05 17:21:52 +00:00
Dan Albert f9dc6670bc Avoid implementation defined behavior in a test.
Summary:
num_put::put uses %p for pointer types, but the exact format of %p is
implementation defined behavior for the C library. Compare output to
snprintf for portability.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 293926
2017-02-02 19:44:11 +00:00