summaryrefslogtreecommitdiffstats
path: root/libcxx/src/experimental
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement LWG 2937 - equivalent("dne", "exists") is not an errorEric Fiselier2017-07-051-6/+9
| | | | | | | | | | | | | | This patch speculatively implements the PR for LWG 2937, which fixes two issues with equivalent. (1) It makes equivalent("dne", "exists") an error. Previously only equivalent("dne", "dne") was an error and the former case was not (it returned false). Now equivalent reports an error when either input doesn't exist. (2) It makes equivalent(p1, p2) well-formed when `is_other(p1) && is_other(p2)`. Previously this was an error, but there is seemingly no reason why it should be on POSIX system. llvm-svn: 307117
* path: Use string_view_t consistentlyDuncan P. N. Exon Smith2017-06-191-2/+3
| | | | | | | | | Most of filesystem/path.cpp uses string_view_t. This fixes the two spots that use string_view directly. https://reviews.llvm.org/D34332 llvm-svn: 305661
* Fix potential bug by casting to the POSIX specified typeEric Fiselier2017-06-161-1/+1
| | | | llvm-svn: 305549
* Fix remaining GCC 7 build warningsEric Fiselier2017-05-051-2/+2
| | | | llvm-svn: 302283
* Fix bugs in filesystem detected by _LIBCPP_ASSERT.Eric Fiselier2017-02-072-7/+16
| | | | | | | | | | | | | | | | | Recently I turned on libc++'s debug mode assertions when CMake is configured with -DLIBCXX_ENABLE_ASSERTIONS=ON. This change exposed assertion failures caused by bugs in filesystem. This patch fixes those failures. The first bug was that `PathParser` was using front()/back() on empty string views in order to get the address of the character. However this is UB on empty strings. Those operations now use data() to obtain the pointer. The second bug was that directory_iterator attempted to capture errno when it was unset and there was an assertion to detect this. llvm-svn: 294360
* filesystem: return the constructed objectSaleem Abdulrasool2017-02-071-5/+2
| | | | | | | | This really should get identified properly by the compiler to convert to a NVRO, but compress the code anyways. This makes the implementation identical to directory_iterator.cpp llvm-svn: 294270
* filesystem: fix n4100 conformance for `temp_directory_path`Saleem Abdulrasool2017-02-051-14/+19
| | | | | | | | | 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
* Recommit [libcxx] Never use <cassert> within libc++Eric Fiselier2017-02-041-4/+0
| | | | | | | | | | It is my opinion that libc++ should never use `<cassert>`, including in the `dylib`. This patch remove all uses of `assert` from within libc++ and replaces most of them with `_LIBCPP_ASSERT` instead. Additionally this patch turn `LIBCXX_ENABLE_ASSERTIONS` off by default, because the standard library should not be aborting user programs unless explicitly asked to. llvm-svn: 294107
* experimental: avoid using raw _WIN32 in filesystemSaleem Abdulrasool2017-01-301-5/+6
| | | | | | | Use the _LIBCPP_WIN32API macro instead of _WIN32 checks. Fix a missed renaming for style conformance. llvm-svn: 293543
* experimental: port directory_iterator to WindowsSaleem Abdulrasool2017-01-301-0/+72
| | | | | | | | | This adds a basic first cut implementation for directory_iterator on Windows. It uses the FindFirstFile/FindNextFile which has the same restrictions as opendir/readdir where there exists a TOCTOU race condition. llvm-svn: 293531
* experimental: add missing file headerSaleem Abdulrasool2017-01-301-0/+9
| | | | | | | The directory_iterator implementation file was missing the file header. Add one. NFC. llvm-svn: 293530
* experimental: inline single use of a typedefSaleem Abdulrasool2017-01-301-4/+1
| | | | | | | The typedef is not particularly long, and used in exactly one location. Just spell it out at the site. NFC. llvm-svn: 293450
* experimental: tolerate the existence of a `__deref` macroSaleem Abdulrasool2017-01-301-2/+2
| | | | | | | | Microsoft's SAL has a `__deref` macro which results in a compilation failure when building the filesystem module on Windows. Rename the member function internally to avoid the conflict. llvm-svn: 293449
* experimental: remove dead functionSaleem Abdulrasool2017-01-291-13/+0
| | | | | | | This template was defined inline, within the TU only and had no uses across the entire repository. Remove the dead code. NFC. llvm-svn: 293445
* Revert "[libcxx] Never use <cassert> within libc++"Eric Fiselier2017-01-241-0/+4
| | | | | | | | This reverts commit r292883. Unfortunately <string_view> uses _LIBCPP_ASSERT in a way which is not compatible with the C++11 dylib build. I'll investigate more tomorrow. llvm-svn: 292923
* [libcxx] Never use <cassert> within libc++Eric Fiselier2017-01-241-4/+0
| | | | | | | | | | | | | | | | | Summary: It is my opinion that libc++ should never use `<cassert>`, including in the `dylib`. This patch remove all uses of `assert` from within libc++ and replaces most of them with `_LIBCPP_ASSERT` instead. Additionally this patch turn `LIBCXX_ENABLE_ASSERTIONS` off by default, because the standard library should not be aborting user programs unless explicitly asked to. Reviewers: mclow.lists, compnerd, smeenai Reviewed By: mclow.lists Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D29063 llvm-svn: 292883
* [libc++] Tolerate presence of __deallocate macroEric Fiselier2017-01-071-1/+1
| | | | | | | | | | | | | | | Summary: On Windows the identifier `__deallocate` is defined as a macro by one of the Windows system headers. Previously libc++ worked around this by `#undef __deallocate` and generating a warning. However this causes the WIN32 version of `__threading_support` to always generate a warning on Windows. This is not OK. This patch renames all usages of `__deallocate` internally as to not conflict with the macro. Reviewers: mclow.lists, majnemer, rnk, rsmith, smeenai, compnerd Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28426 llvm-svn: 291332
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-3/+3
| | | | | | | | | | | | | The name _LIBCPP_TYPE_VIS_ONLY is no longer accurate because both _LIBCPP_TYPE_VIS and _LIBCPP_TYPE_VIS_ONLY expand to __attribute__((__type_visibility__)) with Clang. The only remaining difference is that _LIBCPP_TYPE_VIS_ONLY can be applied to templates whereas _LIBCPP_TYPE_VIS cannot (due to dllimport/dllexport not being allowed on templates). This patch renames _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS. llvm-svn: 291035
* Make variant's index part of the hash valueEric Fiselier2016-12-021-9/+4
| | | | llvm-svn: 288554
* Improve performance of constructing filesystem::path from strings.Eric Fiselier2016-10-301-8/+1
| | | | | | | | | | | | | This patch fixes a performance bug when constructing or appending to a path from a string or c-string. Previously we called 'push_back' to append every single character. This caused multiple re-allocation and copies when at most one reallocation is necessary. The new behavior is to simply call `string::append` so it can correctly handle reallocation. For large strings this change is a ~4x improvement. This also makes our path faster to construct than libstdc++'s. llvm-svn: 285530
* Rewrite std::filesystem::path iterators and parserEric Fiselier2016-10-301-237/+290
| | | | | | | | | | | | | | | | | | | | | | 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
* Fix Clang 3.6 build errorEric Fiselier2016-10-281-1/+1
| | | | llvm-svn: 285445
* Implement LWG 2712 and update other issues statusEric Fiselier2016-10-161-0/+6
| | | | llvm-svn: 284318
* Implement LWG 2681 and 2682Eric Fiselier2016-10-161-0/+3
| | | | llvm-svn: 284316
* Implement LWG 2672.Eric Fiselier2016-10-151-5/+17
| | | | llvm-svn: 284314
* Implement modified LWG 2665Eric Fiselier2016-10-151-0/+10
| | | | llvm-svn: 284313
* Fix LWG2683 - filesystem::copy() should always clear the user-provided ↵Eric Fiselier2016-10-111-6/+2
| | | | | | error_code llvm-svn: 283951
* Workaround missing C++14 constexpr semantics in filesystemEric Fiselier2016-10-101-5/+12
| | | | llvm-svn: 283714
* Remove use of int128_t inside the filesystem implementationEric Fiselier2016-10-101-30/+118
| | | | llvm-svn: 283712
* Partially revert overflow checking in last_write_timeEric Fiselier2016-09-291-5/+7
| | | | llvm-svn: 282660
* Improve 'last_write_time(...)' accuracy and detect overflow errors.Eric Fiselier2016-09-281-5/+35
| | | | | | | | | | | | | | | | | The ::stat struct on Linux, FreeBSD, and OS X provides the access and modification times as an instance of 'timespec', which has a nanosecond resolution. The 'st_mtime' and 'st_atime' members simply reference the 'tv_sec' value of the timespec struct. This patch changes 'last_write_time(...)' so that it extracts both the seconds and nanoseconds values of the last modification time, providing a more accurate implementation of 'last_write_time(...)'. Additionally this patch fixes a possible signed integer overflow bug. The 'file_time_type' type cannot represent all possible values returned by the filesystem. Attempting to construct a 'file_time_type' from one of these values is undefined behavior. This patch avoids that UB by detecting possible overflows before the conversion. llvm-svn: 282634
* Fix possible division by zeroEric Fiselier2016-09-271-1/+1
| | | | llvm-svn: 282468
* memory_resource still needs init_priority when built with GCC 4.9Eric Fiselier2016-09-031-3/+1
| | | | llvm-svn: 280585
* Define _LIBCPP_SAFE_STATIC ↵Eric Fiselier2016-09-031-4/+9
| | | | | | __attribute__((require_constant_initialization)), and apply it to memory_resource llvm-svn: 280561
* Followon to r279744. Find the other exception types and make __throw_XXX ↵Marshall Clow2016-08-252-3/+3
| | | | | | routines (and call them). Remove the generic __libcpp_throw routine, since no one uses it anymore. llvm-svn: 279763
* Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception ↵Marshall Clow2016-08-251-5/+1
| | | | | | type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855. llvm-svn: 279744
* Implement P0392r0. Integrate filesystem::path and string_view.Eric Fiselier2016-07-231-45/+46
| | | | llvm-svn: 276511
* Hide some internal symbols for memory resource.Eric Fiselier2016-07-111-0/+5
| | | | llvm-svn: 275089
* Remove workarounds for C++17 inline variable ABI break. It has been fixed in ↵Eric Fiselier2016-07-021-4/+0
| | | | | | clang. llvm-svn: 274419
* Add another workaround for C++17 inline variable ABI breakage.Eric Fiselier2016-07-011-1/+4
| | | | llvm-svn: 274408
* Cleanup filesystem::permissions ever more.Eric Fiselier2016-06-221-20/+15
| | | | llvm-svn: 273392
* Avoid unnecessary stat call in filesystem::permissions implementation.Eric Fiselier2016-06-221-1/+2
| | | | llvm-svn: 273391
* Implement LWG issue 2720. Replace perms::resolve_symlinks with ↵Eric Fiselier2016-06-211-2/+6
| | | | | | | | | | | | | | | perms::symlink_nofollow. This changes how filesystem::permissions(p, perms) handles symlinks. Previously symlinks were not resolved by default instead only getting resolved when "perms::resolve_symlinks" was used. After this change symlinks are resolved by default and perms::symlink_nofollow must be given to change this. This issue has not yet been moved to Ready status, and I will revert if it doesn't get moved at the current meeting. However I feel confident that it will and it's nice to have implementations when moving issues. llvm-svn: 273328
* Fix bugs in last_write_time implementation.Eric Fiselier2016-06-191-17/+56
| | | | | | | | | | | | | | | * Fix passing a negative number as either tv_usec or tv_nsec. When file_time_type is negative and has a non-zero sub-second value we subtract 1 from tv_sec and make the sub-second duration positive. * Detect and report when 'file_time_type' cannot be represented by time_t. This happens when using large/small file_time_type values with a 32 bit time_t. There is more work to be done in the implementation. It should start to use stat's st_mtim or st_mtimeval if it's provided as an extension. That way we can provide a better resolution. llvm-svn: 273103
* Remove Apple specific guard for utimensat. Use !defined(UTIME_OMIT) instead.Eric Fiselier2016-06-181-5/+4
| | | | | | | As pointed out by @majnemer this is a better way to detect utimensat on all platforms. The Apple specific guard is unneeded. llvm-svn: 273093
* Use utimes instead of utimensat when !defined(UTIME_OMIT). Fixes build for ↵Eric Fiselier2016-06-181-1/+3
| | | | | | older GLIBC versions llvm-svn: 273088
* Add additional tests in an attempt to diagnose ARM test failures.Eric Fiselier2016-06-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Currently 4 tests are failing on the ARM buildbot. To try and diagnose each of the failures this patch does the following: 1) path.itr/iterator.pass.cpp * Temporarily print iteration sequence to see where its failing. 2) path.native.obs/string_alloc.pass.cpp * Remove test that ::new is not called when constructing a short string that requires a conversion. Since during the conversion global locale objects might be constructed. 3) fs.op.funcs/space.pass.cpp * Explicitly use uintmax_t in the implementation of space, hopefully preventing possible overflows. * Add additional tests that check for overflow is the calculation of the space_info values. * Add additional tests for the values returned from statfvs. 4) fs.op.funcs/last_write_time.pass.cpp * No changes made yet. llvm-svn: 273075
* Fix bugs in recursive_directory_iterator::increment(ec) implementation and ↵Eric Fiselier2016-06-171-9/+6
| | | | | | | | | | | | | | | tests. r273060 didn't completely fix the issues in recursive_directory_iterator and the tests. This patch follows up with more fixes * Fix bug where recursive_directory_iterator::increment(ec) did not reset the error code if no failure occurred. * Fix bad assertion in the recursive_directory_iterator::increment(ec) test that would only fire for certain iteration orders. llvm-svn: 273070
* Fix bugs in recursive_directory_iterator implementation and tests.Eric Fiselier2016-06-171-0/+3
| | | | | | | | | | | There are two fixes in this patch: * Fix bug where the constructor of recursive_directory_iterator did not reset the error code if no failure occurred. * Fix tests were dependent on the iteration order of the test directories. llvm-svn: 273060
* Add Filesystem TS -- CompleteEric Fiselier2016-06-173-0/+1402
| | | | | | | | | | | | | | Add the completed std::experimental::filesystem implementation and tests. The implementation supports C++11 or newer. The TS is built as part of 'libc++experimental.a'. Users of the TS need to manually link this library. Building and testing the TS can be disabled using the CMake option '-DLIBCXX_ENABLE_FILESYSTEM=OFF'. Currently 'libc++experimental.a' is not installed by default. To turn on the installation of the library use '-DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON'. llvm-svn: 273034
OpenPOWER on IntegriCloud