summaryrefslogtreecommitdiffstats
path: root/libcxx/test
Commit message (Collapse)AuthorAgeFilesLines
* Workaround OS X 10.11 behavior where stat truncates st_mtimespec to seconds.Eric Fiselier2018-07-261-11/+38
| | | | llvm-svn: 337998
* Add print statements to help debuggingEric Fiselier2018-07-261-11/+21
| | | | llvm-svn: 337991
* Work around GCC bug in constexpr functionEric Fiselier2018-07-251-3/+4
| | | | llvm-svn: 337976
* Remove test which shouldn't have been committedEric Fiselier2018-07-251-19/+0
| | | | llvm-svn: 337971
* [libc++] Use __int128_t to represent file_time_type.Eric Fiselier2018-07-254-218/+481
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The ``file_time_type`` time point is used to represent the write times for files. Its job is to act as part of a C++ wrapper for less ideal system interfaces. The underlying filesystem uses the ``timespec`` struct for the same purpose. However, the initial implementation of ``file_time_type`` could not represent either the range or resolution of ``timespec``, making it unsuitable. Fixing this requires an implementation which uses more than 64 bits to store the time point. I primarily considered two solutions: Using ``__int128_t`` and using a arithmetic emulation of ``timespec``. Each has its pros and cons, and both come with more than one complication. However, after a lot of consideration, I decided on using `__int128_t`. This patch implements that change. Please see the [FileTimeType Design Document](http://libcxx.llvm.org/docs/DesignDocs/FileTimeType.html) for more information. Reviewers: mclow.lists, ldionne, joerg, arthur.j.odwyer, EricWF Reviewed By: EricWF Subscribers: christof, K-ballo, cfe-commits, BillyONeal Differential Revision: https://reviews.llvm.org/D49774 llvm-svn: 337960
* Fix diagnostic test to tolerate Clang diagnosing it as well.Eric Fiselier2018-07-251-0/+5
| | | | | | | | | | | | | | Tuple has tests that ensure we diagnose non-lifetime extended reference bindings inside tuples constructors. As of yesterday, Clang now does this for us. Adjust the test to tolerate the new diagnostics, while still testing that we emit diagnostics of our own. Maybe after this version of Clang has been adopted by most users we should remove our diagnostics; but for now more error detection is better! llvm-svn: 337905
* Fix bugs in create_directory implementation.Eric Fiselier2018-07-253-6/+67
| | | | | | | | | | | | | | Libc++ was incorrectly reporting an error when the target of create_directory already exists, but was not a directory. This behavior is not specified in the most recent standard, which says no error should be reported. Additionally, libc++ failed to report an error when the attribute directory path didn't exist or didn't name a directory. This has been fixed as well. Although it's not clear if we should call status or symlink_status on the attribute directory. This patch chooses to still call status. llvm-svn: 337888
* Fix missing includes in format_string.hpp helperEric Fiselier2018-07-251-4/+5
| | | | llvm-svn: 337886
* New test support for comparisons. Reviewed as https://reviews.llvm.org/D49773Marshall Clow2018-07-251-0/+175
| | | | llvm-svn: 337885
* Make <experimental/filesystem> explicitly require C++11.Eric Fiselier2018-07-251-3/+8
| | | | | | | | | | | | | | Previously the <experimental/filesystem> didn't guard its contents in any dialect. However, the implementation implicitly requires at least C++11, and the tests have always been marked unsupported in C++03. This patch puts a header guard around the contents to avoid exposing them before C++11. Additionally, it replaces all of the usages of _NOEXCEPT or _LIBCPP_CONSTEXPR with the keyword directly, since we can expect the compiler to implement those by now. llvm-svn: 337884
* Stop wrapping __has_include in another macroAlexander Richardson2018-07-241-5/+3
| | | | | | | | | | | | | | Summary: This is not guaranteed to work since the characters after '__has_include(' have special lexing rules that can't possibly be applied when __has_include is generated by a macro. It also breaks the crash reproducers generated by -frewrite-includes (see https://llvm.org/pr37990). Reviewers: EricWF, rsmith, mclow.lists Reviewed By: mclow.lists Differential Revision: https://reviews.llvm.org/D49067 llvm-svn: 337824
* Disable 'suggest braces' warnings for std::array in testsMarshall Clow2018-07-242-0/+7
| | | | llvm-svn: 337808
* Implement <span>. Reviewed as https://reviews.llvm.org/D49338Marshall Clow2018-07-2439-0/+4409
| | | | llvm-svn: 337804
* Fix accidentally removed test.Eric Fiselier2018-07-231-2/+15
| | | | | | | | | When adding the new tests for the filesystem_error::what method, I incorrectly removed a test case and replaced it with something else. This patch restores that test case llvm-svn: 337764
* Fix use of C++14 syntax in C++11 filesystem tests.Eric Fiselier2018-07-231-3/+5
| | | | llvm-svn: 337666
* Implement filesystem_error::what() and improve reporting.Eric Fiselier2018-07-2310-44/+184
| | | | | | | | | | | This patch implements the `what()` for filesystem errors. The message includes the 'what_arg', any paths that were specified, and the error code message. Additionally this patch refactors how errors are created, making it easier to report them correctly. llvm-svn: 337664
* fix test failures with older clang versionsEric Fiselier2018-07-225-4/+36
| | | | llvm-svn: 337658
* Implement a better copy_file.Eric Fiselier2018-07-224-158/+258
| | | | | | | | | | | | | | | | | | | | This patch improves both the performance, and the safety of the copy_file implementation. The performance improvements are achieved by using sendfile on Linux and copyfile on OS X when available. The TOCTOU hardening is achieved by opening the source and destination files and then using fstat to check their attributes to see if we can copy them. Unfortunately for the destination file, there is no way to open it without accidentally creating it, so we first have to use stat to determine if it exists, and if we should copy to it. Then, once we're sure we should try to copy, we open the dest file and ensure it names the same entity we previously stat'ed. llvm-svn: 337649
* Fix two test failures in <experimental/filesystem>Eric Fiselier2018-07-201-1/+1
| | | | | | | | | | First, <experimental/filesystem> didn't correctly guard against min/max macros. This adds the proper push/pop macro guards. Second, an internal time helper had been renamed but the test for it hadn't been updated. This patch updates those tests. llvm-svn: 337520
* [libc++] Implement Directory Entry Caching -- Sort of.Eric Fiselier2018-07-2022-250/+2335
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements directory_entry caching *almost* as specified in P0317r1. However, I explicitly chose to deviate from the standard as I'll explain below. The approach I decided to take is a fully caching one. When `refresh()` is called, the cache is populated by calls to `stat` and `lstat` as needed. During directory iteration the cache is only populated with the `file_type` as reported by `readdir`. The cache can be in the following states: * `_Empty`: There is nothing in the cache (likely due to an error) * `_IterSymlink`: Created by directory iteration when we walk onto a symlink only the symlink file type is known. * `_IterNonSymlink`: Created by directory iteration when we walk onto a non-symlink. Both the regular file type and symlink file type are known. * `_RefreshSymlink` and `_RefreshNonSymlink`: A full cache created by `refresh()`. This case includes dead symlinks. * `_RefreshSymlinkUnresolved`: A partial cache created by refresh when we fail to resolve the file pointed to by a symlink (likely due to permissions). Symlink attributes are cached, but attributes about the linked entity are not. As mentioned, this implementation purposefully deviates from the standard. According to some readings of the specification, and the Windows filesystem implementation, the constructors and modifiers which don't pass an `error_code` must throw when the `directory_entry` points to a entity which doesn't exist. or when attribute resolution fails for another reason. @BillyONeal has proposed a more reasonable set of requirements, where modifiers other than refresh ignore errors. This is the behavior libc++ currently implements, with the expectation some form of the new language will be accepted into the standard. Some additional semantics which differ from the Windows implementation: 1. `refresh` will not throw when the entry doesn't exist. In this case we can still meet the functions specification, so we don't treat it as an error. 2. We don't clear the path name when a constructor fails via refresh (this will hopefully be changed in the standard as well). It should be noted that libstdc++'s current implementation has the same behavior as libc++, except for point (2). If the changes to the specification don't get accepted, we'll be able to make the changes later. [1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0317r1.html Reviewers: mclow.lists, gromer, ldionne, aaron.ballman Subscribers: BillyONeal, christof, cfe-commits Differential Revision: https://reviews.llvm.org/D49530 llvm-svn: 337516
* Fix a couple of 'unused variable' warnings in a vector test. NFC.Marshall Clow2018-07-131-0/+4
| | | | llvm-svn: 337016
* Turns out that wide literals U"xxx" and u"xxx" are c++11 and later.Marshall Clow2018-07-121-0/+2
| | | | llvm-svn: 336880
* Same reversed ifdef happened twice. Test fix only, NFC to the library.Marshall Clow2018-07-111-1/+1
| | | | llvm-svn: 336856
* Fix a test #ifdef that was reversed. NFC to the library.Marshall Clow2018-07-111-1/+1
| | | | llvm-svn: 336855
* [test] two small cleanups:Casey Carter2018-07-092-5/+2
| | | | | | | | * Remove unused type from is_assignable.pass.cpp * Don't specialize `common_type<::X<float>>` in common_type.pass.cpp, which violates the requirements of [meta.trans.other]/5 llvm-svn: 336618
* Implement LWG 2946, 3075 and 3076. Reviewed as https://reviews.llvm.org/D48616Marshall Clow2018-07-0225-40/+454
| | | | llvm-svn: 336132
* [libcxx] [test] Strip trailing whitespace. NFC.Stephan T. Lavavej2018-06-1419-38/+38
| | | | llvm-svn: 334676
* [libcxx] [test] Update msvc_stdlib_force_include.hpp.Stephan T. Lavavej2018-06-141-11/+0
| | | | | | | | MSVC's STL removed _SCL_SECURE_NO_WARNINGS. MSVC's STL implemented feature-test macros. llvm-svn: 334675
* Mark the test using <experimental/memory_resource> to require c++experimental.Volodymyr Sapsai2018-06-111-0/+1
| | | | | | | | | | | | | | | | | When built against the old libc++ version the test was causing linker error Undefined symbols for architecture x86_64: "std::experimental::fundamentals_v1::pmr::new_delete_resource()", referenced from: void test_evil<WidgetV0, WidgetV0>() in construct_piecewise_pair_evil.pass.cpp.o void test_evil<WidgetV0, WidgetV1>() in construct_piecewise_pair_evil.pass.cpp.o void test_evil<WidgetV0, WidgetV2>() in construct_piecewise_pair_evil.pass.cpp.o void test_evil<WidgetV0, WidgetV3>() in construct_piecewise_pair_evil.pass.cpp.o void test_evil<WidgetV1, WidgetV0>() in construct_piecewise_pair_evil.pass.cpp.o void test_evil<WidgetV1, WidgetV1>() in construct_piecewise_pair_evil.pass.cpp.o void test_evil<WidgetV1, WidgetV2>() in construct_piecewise_pair_evil.pass.cpp.o ... llvm-svn: 334431
* Fix test failures after r334053.Eric Fiselier2018-06-066-9/+20
| | | | llvm-svn: 334056
* Fix PR37694 - std::vector doesn't correctly move construct allocators.Eric Fiselier2018-06-054-5/+213
| | | | | | | | | | | | | | | | | | | C++2a[container.requirements.general]p8 states that when move constructing a container, the allocator is move constructed. Vector previously copy constructed these allocators. This patch fixes that bug. Additionally it cleans up some unnecessary allocator conversions when copy constructing containers. Libc++ uses __internal_allocator_traits::select_on_copy_construction to select the correct allocator during copy construction, but it unnecessarily converted the resulting allocator to the user specified allocator type and back. After this patch list and forward_list no longer do that. Technically we're supposed to be using allocator_traits<allocator_type>::select_on_copy_construction, but that should seemingly be addressed as a separate patch, if at all. llvm-svn: 334053
* Filesystem tests: un-confuse write timeJF Bastien2018-06-011-14/+13
| | | | | | | | | | | | | | | | | | | | | | Summary: The filesystem test was confused about access versus write / modification time. The spec says: file_time_type last_write_time(const path& p, error_code& ec) noexcept; Returns: The time of last data modification of p, determined as if by the value of the POSIX stat structure member st_mtime obtained as if by POSIX stat(). The signature with argument ec returns file_time_type::min() if an error occurs. The test was looking at st_atime, not st_mtime, when comparing the result from last_write_time. That was probably due to using a pair instead of naming things nicely or using types. I opted to rename things so it's clearer. This used to cause test bot failures. <rdar://problem/40648859> Reviewers: EricWF, mclow.lists, aemerson Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D47557 llvm-svn: 333723
* Mark deduction guide tests as failing on apple-clang-9JF Bastien2018-05-294-4/+4
| | | | | | | As discussed here: http://lists.llvm.org/pipermail/cfe-dev/2018-May/058116.html The tests fail on clang-5, as well as apple-clang-9. Mark them as such. llvm-svn: 333479
* Fix embarrasing typo in uncaught_exceptions. Update tests to really test ↵Marshall Clow2018-05-291-21/+29
| | | | | | this. Thanks to Peter Klotz for calling my attention to this. llvm-svn: 333467
* LWG 2969 "polymorphic_allocator::construct() shouldn't pass resource()"Eric Fiselier2018-05-298-24/+307
| | | | | | | | | | | | | | | | | | | Patch from Arthur O'Dwyer. In the TS, `uses_allocator` construction for `pair` tried to use an allocator type of `memory_resource*`, which is incorrect because `memory_resource*` is not an allocator type. LWG 2969 fixed it to use `polymorphic_allocator` as the allocator type instead. https://wg21.link/lwg2969 (D47090 included this in `<memory_resource>`; at Eric's request, I've split this out into its own patch applied to the existing `<experimental/memory_resource>` instead.) Reviewed as https://reviews.llvm.org/D47109 llvm-svn: 333384
* Fix up the final bits of breakage due to clang v5 generating bad implicit ↵Marshall Clow2018-05-283-12/+17
| | | | | | template deduction guides - specifically for copy-ctors llvm-svn: 333381
* Mark the template deduction tests as UNSUPPORTED on clang 5, because it ↵Marshall Clow2018-05-282-1/+6
| | | | | | deduces the wrong type. llvm-svn: 333376
* Revert "Add nonnull; use it for atomics"JF Bastien2018-05-261-92/+0
| | | | | | | | | | | | | | That's r333325, as well as follow-up "Fix GCC handling of ATOMIC_VAR_INIT" r333327. Marshall asked to revert: Let's have a discussion about how to implement this so that it is more friendly to people with installed code bases. We've had *extremely* loud responses to unilaterally adding warnings - especially ones that can't be easily disabled - to the libc++ code base in the past. llvm-svn: 333351
* Fix GCC handling of ATOMIC_VAR_INITJF Bastien2018-05-261-2/+2
| | | | | | r333325 from D47225 added warning checks, and the test was written to be C++11 correct by using ATOMIC_VAR_INIT (note that the committee fixed that recently...). It seems like GCC can't handle ATOMIC_VAR_INIT well because it generates 'type 'std::atomic<int>' cannot be initialized with an initializer list' on bot libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03. Drop the ATOMIC_VAR_INITs since they weren't required to test the diagnostics. llvm-svn: 333327
* Add nonnull; use it for atomicsJF Bastien2018-05-251-0/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The atomic non-member functions accept pointers to std::atomic / std::atomic_flag as well as to the non-atomic value. These are all dereferenced unconditionally when lowered, and therefore will fault if null. It's a tiny gotcha for new users, especially when they pass in NULL as expected value (instead of passing a pointer to a NULL value). We can therefore use the nonnull attribute to denote that: - A warning should be generated if the argument is null - It is undefined behavior if the argument is null (because a dereference will segfault) This patch adds support for this attribute for clang and GCC, and sticks to the subset of the syntax both supports. In particular, work around this GCC oddity: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60625 The attributes are documented: - https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html - https://clang.llvm.org/docs/AttributeReference.html#nullability-attributes I'm authoring a companion clang patch for the __c11_* and __atomic_* builtins, which currently only warn on a subset of the pointer parameters. In all cases the check needs to be explicit and not use the empty nonnull list, because some of the overloads are for atomic<T*> and the values themselves are allowed to be null. <rdar://problem/18473124> Reviewers: arphaman, EricWF Subscribers: aheejin, christof, cfe-commits Differential Revision: https://reviews.llvm.org/D47225 llvm-svn: 333325
* Fix optional<char> test breakageJF Bastien2018-05-251-0/+4
| | | | | | It seems GCC and clang disagree. Talked to mclow on IRC, disabling for now. llvm-svn: 333317
* Fix array deduction guide test breakageJF Bastien2018-05-251-0/+3
| | | | | | No matching constructor llvm-svn: 333315
* Fix optional deduction guide test breakageJF Bastien2018-05-252-2/+2
| | | | llvm-svn: 333308
* Add one more test for optionalMarshall Clow2018-05-251-5/+14
| | | | llvm-svn: 333252
* Add deduction guides for optionalMarshall Clow2018-05-252-0/+82
| | | | llvm-svn: 333251
* Do not define template specialization __libcpp_is_floating_point<__fp16>Akira Hatanaka2018-05-231-0/+2
| | | | | | | | if the compiler is not clang. gcc doesn't allow using __fp16 on non-ARM targets. llvm-svn: 333108
* Teach __libcpp_is_floating_point that __fp16 and _Float16 areAkira Hatanaka2018-05-231-0/+22
| | | | | | | | floating-point types. rdar://problem/40377353 llvm-svn: 333103
* Implement deduction guides for basic_regexMarshall Clow2018-05-232-0/+182
| | | | llvm-svn: 333050
* [libcxx] [test] Mark the test as unsupported by apple-clang-8.1.Volodymyr Sapsai2018-05-221-1/+1
| | | | llvm-svn: 333011
* Missed the tests for the deduction guides for prority_queueMarshall Clow2018-05-222-0/+181
| | | | llvm-svn: 332931
OpenPOWER on IntegriCloud