summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std
Commit message (Collapse)AuthorAgeFilesLines
...
* Rewrite and cleanup unique_ptr tests.Eric Fiselier2017-04-15171-6899/+2208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch almost entirely rewrites the unique_ptr tests. There are a couple of reasons for this: A) Most of the *.fail.cpp tests were either incorrect or could be better written as a *.pass.cpp test that uses <type_traits> to check if certain operations are valid (Ex. Using static_assert(!std::is_copy_constructible_v<T>) instead of writing a failure test). B) [unique.ptr.runtime] has very poor test coverage. Many of the constructors and assignment operators have to tests at all. The special members that have tests have very few test cases and are typically way out of date. C) The tests for [unique.ptr.single] and [unique.ptr.runtime] are largely duplicates of each other. This means common requirements have two different sets of tests in two different test files. This makes the tests harder to maintain than if there was a single copy. To address (A) this patch changes almost all of the *.fail.cpp tests into .pass.cpp tests using type traits; Allowing the *.fail.cpp tests to be removed. The address (B) and (C) the tests for [unique.ptr.single] and [unique.ptr.runtime] have been combined into a single directory, allowing both specializations to share common tests. Tests specific to the single/runtime specializations are given the suffix "*.single.pass.cpp" or "*.runtime.pass.cpp". Finally the unique.ptr test have been moved into the correct directory according to the standard. Specifically they have been removed from "utilities/memory" into "utilities/smartptr". PS. This patch also adds newly written tests for upcoming unique_ptr changes/fixes. However since these tests don't currently pass they are guarded by the macro TEST_WORKAROUND_UPCOMING_UNIQUE_PTR_CHANGES. This allows other STL's to validate the tests before libc++ implements the changes. The relevant libc++ changes should land in the next week. llvm-svn: 300388
* Remove the binders from C++17. Reviewed as https://reviews.llvm.org/D31769Marshall Clow2017-04-1344-0/+674
| | | | llvm-svn: 300232
* Implement LWG#2855 - made easy by previous refactoringMarshall Clow2017-04-131-0/+10
| | | | llvm-svn: 300218
* Cleanup any_cast failure testEric Fiselier2017-04-131-8/+25
| | | | llvm-svn: 300175
* Fix template >> within C++03 codeEric Fiselier2017-04-131-1/+1
| | | | llvm-svn: 300165
* Diagnose when reverse_iterator is used on path::iterator.Eric Fiselier2017-04-131-7/+5
| | | | | | | | | | | | | | | path::iterator isn't a strictly conforming iterator. Specifically it stashes the current element inside the iterator. This leads to UB when used with reverse_iterator since it requires the element to outlive the lifetime of the iterator. This patch adds a static_assert inside reverse_iterator to disallow "stashing iterator types", and it tags path::iterator as such a type. Additionally this patch removes all uses of reverse_iterator<path::iterator> within the tests. llvm-svn: 300164
* Fix C++03 test failuresEric Fiselier2017-04-132-2/+2
| | | | llvm-svn: 300159
* Add tests that std::unique_ptr's default constructor is constexpr.Eric Fiselier2017-04-133-49/+50
| | | | | | | | | | | | std::unique_ptr's default constructor must be constexpr in order to allow constant initialization to take place for static objects; Even though we can never have a constexpr unique_ptr variable since it's not a literal type. This patch adds tests that constant initialization takes place by using the __attribute__((require_constant_initialization)) macro. llvm-svn: 300158
* Fix most failures caused by r300140Eric Fiselier2017-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | r300140 introduced a bunch of failures by changing the internal interface provided by __compressed_pair. This patch fixes all of the failures caused by the new interface by changing the existing code to use it. In addition to those changes this patch also fixes two separate issues causing test failures: 1) Fix the member swap definition for __map_value_compare. Previously the swap was incorrectly configured to swap the comparator as const. 2) Fix an assertion failure in futures.task.members/ctor_func_alloc.pass.cpp that incorrectly expected a move to take place when a single copy is sufficient. There is one remaining failure regarding make_shared. I'll commit a fix for that shortly. llvm-svn: 300148
* [libcxx] Fix __compressed_pair so it doesn't copy the argument multiple ↵Eric Fiselier2017-04-121-13/+14
| | | | | | | | | | | | | | | | | | | | | times, and add constexpr. Summary: __compressed_pair takes and passes it's constructor arguments by value. This causes arguments to be moved 3 times instead of once. This patch addresses that issue and fixes `constexpr` on the constructors. I would rather have this fix than D27564, and I'm fairly confident it's not ABI breaking but I'm not 100% sure. I prefer this solution because it removes a lot of code and makes the implementation *much* smaller. Reviewers: mclow.lists, K-ballo Reviewed By: K-ballo Subscribers: K-ballo, cfe-commits Differential Revision: https://reviews.llvm.org/D27565 llvm-svn: 300140
* Fix test failures with older Clang versionsEric Fiselier2017-04-122-0/+4
| | | | llvm-svn: 300132
* [libc++] Implement LWG 2911 - add an is_aggregate type-traitEric Fiselier2017-04-121-0/+79
| | | | | | | | | | | | | | | | | Summary: This patch implements http://cplusplus.github.io/LWG/lwg-defects.html#2911. I'm putting this up for review until __is_aggregate is added to clang (See D31513) Reviewers: mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31515 llvm-svn: 300126
* Additional test file for r300123Marshall Clow2017-04-121-17/+47
| | | | llvm-svn: 300124
* Implement part of LWG#2857 - any/optional. Still to do - variant. Reviewed ↵Marshall Clow2017-04-121-9/+27
| | | | | | as https://reviews.llvm.org/D31956 llvm-svn: 300123
* Fix incorrectly qualified return type from unique_ptr::get_deleter().Eric Fiselier2017-04-122-22/+60
| | | | | | | | | | | For reference deleter types the const qualifier on the return type of get_deleter() should be ignored, and a non-const deleter should be returned. This patch fixes a bug where "const deleter_type&" is incorrectly formed. llvm-svn: 300121
* [libcxx] [test] Avoid Clang's -Wunused-const-variable in ↵Stephan T. Lavavej2017-04-121-0/+1
| | | | | | | | | | is_constructible.pass.cpp. This happens when using Clang with MSVC's STL, so there are no actual uses of this variable. Fixes D31966. llvm-svn: 300079
* Add some FAIL constexpr tests for optional's copy/move ctors.Marshall Clow2017-04-122-0/+73
| | | | llvm-svn: 300009
* Implement LWG#2873: 'Add noexcept to several shared_ptr related functions' ↵Marshall Clow2017-04-115-15/+35
| | | | | | This issue missed a couple, so I added those as well (see LWG#2942) llvm-svn: 299963
* Fix a C++03 failureMarshall Clow2017-04-111-3/+3
| | | | llvm-svn: 299909
* Remove some trigraphs that GCC was complaining aboutMarshall Clow2017-04-111-2/+2
| | | | llvm-svn: 299907
* Fix PR#32605: common_type<T> is not SFINAE-friendlyMarshall Clow2017-04-101-1/+5
| | | | llvm-svn: 299901
* Fix PR#32606: std::decay mishandles abominable function typesMarshall Clow2017-04-101-0/+6
| | | | llvm-svn: 299894
* Revert "Allow a standard library to implement conditional noexcept for ↵Akira Hatanaka2017-04-072-11/+4
| | | | | | | | optional and unique_ptr hash functions." This reverts commit r299734. llvm-svn: 299744
* Add noexcept(false) to more strongly indicate that not being noexcept is ↵Billy Robert O'Neal III2017-04-062-2/+2
| | | | | | important for hash tests. llvm-svn: 299735
* Allow a standard library to implement conditional noexcept for optional and ↵Billy Robert O'Neal III2017-04-062-4/+11
| | | | | | | | | | unique_ptr hash functions. These tests were unconditionally asserting that optional and unique_ptr declare throwing hashes, but MSVC++ implements conditional noexcept forwarding that of the underlying hash function. As a result we were failing these tests but there's nothing forbidding strengthening noexcept in that way. Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have non-noexcept hash functions. llvm-svn: 299734
* Some of Eric's buildbots don't like this test. Disable it while I figure out ↵Marshall Clow2017-04-061-0/+2
| | | | | | why. llvm-svn: 299686
* Recommit awk tests with warnings removed. Initial commit r299652, reverted ↵Marshall Clow2017-04-061-48/+47
| | | | | | r299656. llvm-svn: 299680
* Revert "Restore Missing awk regex tests. Thanks to dexonsmith for noticing, ↵Mehdi Amini2017-04-061-8/+9
| | | | | | | | and proposing this as https://reviews.llvm.org/D16541" This reverts commit r299652, 32bits MacOS is broken. llvm-svn: 299656
* Restore Missing awk regex tests. Thanks to dexonsmith for noticing, and ↵Marshall Clow2017-04-061-9/+8
| | | | | | proposing this as https://reviews.llvm.org/D16541 llvm-svn: 299652
* Fix more -Wshadow warnings introduced by recent Clang changeEric Fiselier2017-04-046-7/+0
| | | | llvm-svn: 299411
* Fix LWG 2934 - optional<const T> doesn't compare with TEric Fiselier2017-03-3012-400/+534
| | | | llvm-svn: 299105
* Implement LWG 2842 - optional(U&&) needs to SFINAE on decay_t<in_place_t>Eric Fiselier2017-03-301-0/+14
| | | | llvm-svn: 299100
* Mark *pass tests as UNUSUPPORTED instead of XFAIL on old compilersMarshall Clow2017-03-2712-24/+24
| | | | llvm-svn: 298839
* Mark *fail tests as UNUSUPPORTED instead of XFAIL on old compilersMarshall Clow2017-03-275-10/+10
| | | | llvm-svn: 298832
* XFAIL the std::byte tests on a bunch of old clang versions, because they ↵Marshall Clow2017-03-2417-0/+51
| | | | | | don't like 'std::byte b1{1}' llvm-svn: 298706
* Implement P0298R3: 'std::byte'. Reviewed as https://reviews.llvm.org/D31022Marshall Clow2017-03-2418-0/+562
| | | | llvm-svn: 298689
* Implement Pp0156r2: 'Variadic Lock Guard, version 5' Reviewed as ↵Marshall Clow2017-03-2410-77/+145
| | | | | | https://reviews.llvm.org/D31163. llvm-svn: 298681
* Update the algorithm tests to not use the (deprecated) function binders. No ↵Marshall Clow2017-03-237-14/+42
| | | | | | functional change. llvm-svn: 298618
* [libcxx] Improve code generation for vector::clear().Bruce Mitchener2017-03-231-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: By manipulating a local variable in the loop, when the loop can be optimized away (due to no non-trivial destructors), this lets it be fully optimized away and we modify the __end_ separately. This results in a substantial improvement in the generated code. Prior to this change, this would be generated (on x86_64): movq (%rdi), %rdx movq 8(%rdi), %rcx cmpq %rdx, %rcx je LBB2_2 leaq -12(%rcx), %rax subq %rdx, %rax movabsq $-6148914691236517205, %rdx ## imm = 0xAAAAAAAAAAAAAAAB mulq %rdx shrq $3, %rdx notq %rdx leaq (%rdx,%rdx,2), %rax leaq (%rcx,%rax,4), %rax movq %rax, 8(%rdi) And after: movq (%rdi), %rax movq %rax, 8(%rdi) This brings this in line with what other implementations do. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25241 llvm-svn: 298601
* Use 'REQUIRES: c++98 || c++03 || c++11 || c++14' instead of the deprecated ↵Marshall Clow2017-03-232-2/+2
| | | | | | 'REQUIRES-ANY: c++98, c++03, c++11, c++14' llvm-svn: 298600
* Remove random_shuffle in C++17. Please use shuffle instead. If you have to, ↵Marshall Clow2017-03-232-0/+2
| | | | | | you cant get it back by defining _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE before including any libc++ headers. llvm-svn: 298597
* Silence a couple of 'unused variable' warnings in c++03 tests. No functional ↵Marshall Clow2017-03-232-0/+2
| | | | | | change llvm-svn: 298582
* Worked around GCC bug 56480. Explicit specialization in a different namespace.Michael Park2017-03-232-2/+10
| | | | | | | | | | | | Summary: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Reviewers: EricWF Reviewed By: EricWF Differential Revision: https://reviews.llvm.org/D31273 llvm-svn: 298581
* Can't test for noexcept on C++03; std::hash<nullptr_t> isn't available until ↵Marshall Clow2017-03-231-0/+3
| | | | | | C++17 llvm-svn: 298580
* Implement P0599: 'noexcept for hash functions'. Fix a couple of hash ↵Marshall Clow2017-03-2314-26/+65
| | | | | | functions (optional<T> and unique_ptr<T>) which were mistakenly marked as 'noexcept'. Reviewed as https://reviews.llvm.org/D31234 llvm-svn: 298573
* Fix a couple of 'C++11'-isms from the last checkin, which broke the '03 bot.Marshall Clow2017-03-212-4/+4
| | | | llvm-svn: 298422
* Add a bit more to one of the chrono testsMarshall Clow2017-03-211-0/+11
| | | | llvm-svn: 298418
* Implement P0548: 'common_type and duration' This involves a subtle change in ↵Marshall Clow2017-03-213-4/+41
| | | | | | the return type of the unary +/- operators for std::chrono::duration, though I expect that no one will notice. llvm-svn: 298416
* Implement LWG#2761: 'basic_string should require that charT match ↵Marshall Clow2017-03-152-1/+25
| | | | | | traits::char_type'. Tests for string_view, too llvm-svn: 297872
* Add deployment knobs to tests (for Apple platforms)Mehdi Amini2017-03-1528-56/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud