Commit Graph

83 Commits

Author SHA1 Message Date
Louis Dionne
4211451486 [libcxx] Slightly improved policy for handling experimental features
Summary:
Following the discussion on the libcxx-dev mailing list
(http://lists.llvm.org/pipermail/libcxx-dev/2019-May/000358.html),
this implements the new policy for handling experimental features and
their deprecation. We basically add a deprecation warning for
std::experimental::filesystem, and we remove a bunch of <experimental/*>
headers that were now empty.

Reviewers: mclow.lists, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, arphaman, libcxx-commits, jfb

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@363072 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-11 14:48:40 +00:00
Marshall Clow
b6e011b18b Add include for 'test_macros.h' to all the tests that were missing them. Thanks to Zoe for the (big, but simple) patch. NFC intended.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@362252 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-31 18:35:30 +00:00
JF Bastien
e15dd4e32e Support tests in freestanding
Summary:
Freestanding is *weird*. The standard allows it to differ in a bunch of odd
manners from regular C++, and the committee would like to improve that
situation. I'd like to make libc++ behave better with what freestanding should
be, so that it can be a tool we use in improving the standard. To do that we
need to try stuff out, both with "freestanding the language mode" and
"freestanding the library subset".

Let's start with the super basic: run the libc++ tests in freestanding, using
clang as the compiler, and see what works. The easiest hack to do this:

In utils/libcxx/test/config.py add:

  self.cxx.compile_flags += ['-ffreestanding']

Run the tests and they all fail.

Why? Because in freestanding `main` isn't special. This "not special" property
has two effects: main doesn't get mangled, and main isn't allowed to omit its
`return` statement. The first means main gets mangled and the linker can't
create a valid executable for us to test. The second means we spew out warnings
(ew) and the compiler doesn't insert the `return` we omitted, and main just
falls of the end and does whatever undefined behavior (if you're luck, ud2
leading to non-zero return code).

Let's start my work with the basics. This patch changes all libc++ tests to
declare `main` as `int main(int, char**` so it mangles consistently (enabling us
to declare another `extern "C"` main for freestanding which calls the mangled
one), and adds `return 0;` to all places where it was missing. This touches 6124
files, and I apologize.

The former was done with The Magic Of Sed.

The later was done with a (not quite correct but decent) clang tool:

  https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed

This works for most tests, though I did have to adjust a few places when e.g.
the test runs with `-x c`, macros are used for main (such as for the filesystem
tests), etc.

Once this is in we can create a freestanding bot which will prevent further
regressions. After that, we can start the real work of supporting C++
freestanding fairly well in libc++.

<rdar://problem/47754795>

Reviewers: ldionne, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353086 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04 20:31:13 +00:00
Chandler Carruth
7c3769df62 Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351648 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 10:56:40 +00:00
Eric Fiselier
a0866c5fb5 Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.

Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).

The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).

Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.

In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338093 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-27 03:07:09 +00:00
Eric Fiselier
cff3d7b202 Correct comment about stat truncating st_mtimespec to seconds
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338000 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-26 03:42:25 +00:00
Eric Fiselier
6655abbc33 Workaround OS X 10.11 behavior where stat truncates st_mtimespec to seconds.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337998 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-26 03:28:48 +00:00
Eric Fiselier
8940394a74 Add print statements to help debugging
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337991 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-26 01:10:50 +00:00
Eric Fiselier
0c29afae93 Remove test which shouldn't have been committed
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337971 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-25 21:58:37 +00:00
Eric Fiselier
81872e95bf [libc++] Use __int128_t to represent file_time_type.
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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337960 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-25 20:51:49 +00:00
Eric Fiselier
8410c8170a Fix bugs in create_directory implementation.
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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337888 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-25 04:46:32 +00:00
Eric Fiselier
2493db4b26 Make <experimental/filesystem> explicitly require C++11.
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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337884 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-25 03:41:31 +00:00
Eric Fiselier
f581ed2017 Fix accidentally removed test.
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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337764 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 22:39:56 +00:00
Eric Fiselier
0ddb77a467 Implement filesystem_error::what() and improve reporting.
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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337664 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 02:00:52 +00:00
Eric Fiselier
1061b65e6e fix test failures with older clang versions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337658 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-22 20:50:16 +00:00
Eric Fiselier
70c866bfc1 Implement a better copy_file.
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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337649 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-22 02:00:53 +00:00
Eric Fiselier
e274f439c6 [libc++] Implement Directory Entry Caching -- Sort of.
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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337516 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-20 01:22:32 +00:00
JF Bastien
c8846cc964 Filesystem tests: un-confuse write time
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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333723 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 04:59:48 +00:00
Jan Korous
75b7f52ace [libcxx][test] Fix fs::proximate tests on platforms where /net exists.
Following Eric's patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329199 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 14:23:51 +00:00
Jan Korous
dd8722ce53 [libcxx][test] Improve assert message
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329194 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 13:31:39 +00:00
Eric Fiselier
efbbeb195f Fix fs::proximate tests on platforms where /net exists.
The proximate tests depended on `/net` not being a valid path,
however, on OS X it is.

Correct the tests to handle this.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329038 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 01:52:12 +00:00
Eric Fiselier
e96d6a1fb7 Implement P0430R2 - File system library on non-POSIX systems.
This patch implements P0430R2, who's largest change is adding the path::format
enumeration for supporting path format conversions in path constructors.

However, since libc++'s filesystem only really supports POSIX like systems,
there are no real changes needed. This patch simply adds the format enum
and then ignores it when it's passed to constructors.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329031 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 23:35:24 +00:00
Eric Fiselier
1e34c76d33 Implement filesystem NB comments, relative paths, and related issues.
This is a fairly large patch that implements all of the filesystem NB comments
and the relative paths changes (ex. adding weakly_canonical). These issues
and papers are all interrelated so their implementation couldn't be split up
nicely.

This patch upgrades <experimental/filesystem> to match the C++17 spec and not
the published experimental TS spec. Some of the changes in this patch are both
API and ABI breaking, however libc++ makes no guarantee about stability for
experimental implementations.

The major changes in this patch are:

* Implement NB comments for filesystem (P0492R2), including:
  * Implement `perm_options` enum as part of NB comments, and update the
    `permissions` function to match.
  * Implement changes to `remove_filename` and `replace_filename`
  * Implement changes to `path::stem()` and `path::extension()` which support
    splitting examples like `.profile`.
  * Change path iteration to return an empty path instead of '.' for trailing
    separators.
  * Change `operator/=` to handle absolute paths on the RHS.
  * Change `absolute` to no longer accept a current path argument.

* Implement relative paths according to NB comments (P0219r1)

* Combine `path.cpp` and `operations.cpp` since some path functions require
  access to the operations internals, and some fs operations require access
  to the path parser.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329028 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 23:03:41 +00:00
Eric Fiselier
245b3a06a1 Fix test case initialization issues in permissions test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328477 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 07:06:25 +00:00
Eric Fiselier
f2c93738b8 Implement filesystem::perm_options specified in NB comments.
The NB comments for filesystem changed permissions and added
a new enum `perm_options` which control how the permissions
are applied.

This implements than NB resolution

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328476 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 06:23:55 +00:00
Eric Fiselier
f1471a367b Make filesystem tests generic between experimental and std versions.
As I move towards implementing std::filesystem, there is a need to
make the existing tests run against both the std and experimental versions.
Additionally, it's helpful to allow running the tests against other
implementations of filesystem.

This patch converts the test to easily target either. First, it
adds a filesystem_include.hpp header which is soley responsible
for selecting and including the correct implementation. Second,
it converts existing tests to use this header instead of including
filesystem directly.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328475 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 05:46:57 +00:00
Volodymyr Sapsai
04dd960ff3 [libcxx] Fix last_write_time test for filesystems that don't support very small times.
APFS minimum supported file write time is -2^63 nanoseconds, which doesn't go
as far as `file_time_type::min()` that is equal to -2^63 microseconds on macOS.

This change doesn't affect filesystems that support `file_time_type` range only
for in-memory file time representation but not for on-disk representation. Such
filesystems are considered as `SupportsMinTime`.

rdar://problem/35865151

Reviewers: EricWF, Hahnfeld

Subscribers: jkorous-apple, mclow.lists, cfe-commits, christof

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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326383 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-28 23:27:40 +00:00
Eric Fiselier
4d0f42850b Implement LWG 3014 - Fix more noexcept issues in filesystem.
This patch removes the noexcept declaration from filesystem
operations which require creating temporary paths or
creating a directory iterator. Either of these operations
can throw.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324192 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-04 07:35:36 +00:00
Eric Fiselier
9611902923 Remove debug println from rec.dir.itr.increment test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324190 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-04 03:26:55 +00:00
Eric Fiselier
0b47a655ac Implement LWG2989: path's streaming operators allow everything under the sun.
Because path can be constructed from a ton of different types, including string
and wide strings, this caused it's streaming operators to suck up all sorts
of silly types via silly conversions. For example:

using namespace std::experimental::filesystem::v1;
std::wstring w(L"wide");
std::cout << w; // converts to path.

This patch tentatively adopts the resolution to LWG2989 and fixes the issue
by making the streaming operators friends of path.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324189 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-04 03:10:53 +00:00
Eric Fiselier
af1fd7c75f Address LWG 2849 and fix missing failure condition in copy_file.
Previously copy_file didn't handle the case where the input and
output were the same file.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324187 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-04 02:43:32 +00:00
Ekaterina Vaartis
cce11ce7c2 Add error code handling to remove_all test
As mentioned by EricWF in revision D41830



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322351 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-12 05:02:06 +00:00
Ekaterina Vaartis
45d5893943 Make std::experimental::filesystem::remove and remove_all return false or 0 if the file doesn't exist
Differential Revision: https://reviews.llvm.org/D41830



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322293 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-11 17:04:29 +00:00
Stephan T. Lavavej
8148a70b20 [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319994 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-07 00:50:23 +00:00
Marshall Clow
bc6989bcbd More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in filesystem::path
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318378 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16 05:48:32 +00:00
Eric Fiselier
a4c272d82f Implement LWG 3013 - some filesystem members should not be noexcept.
LWG 3013 points out that the constructors and increment members
of the directory iterators need to allocate, and therefore cannot
be marked noexcept.

It also points out that `is_empty` and `copy` likely need to allocate
as well, and as such can also not be noexcept.

This patch speculatively implements the resolution removing noexcept,
because libc++ does indeed have the possibility of throwing on allocation
failure.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@316941 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30 18:59:59 +00:00
Eric Fiselier
fba9cd8c9e Fix PR35078 - recursive directory iterator's increment method throws incorrectly.
The guts of the increment method for recursive_directory_iterator
was failing to pass an error code object to calls to status/symlink_status,
which can throw under certain conditions.

This patch fixes the issues by correctly propagating the error codes.
However the noexcept still needs to be removed from the signature, as
mentioned in LWG 3014, but that change will be made in a separate commit.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@316939 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30 18:43:21 +00:00
Roman Lebedev
5cf53b55e6 Fix last_write_time.pass.cpp to work with clang-3.9 and earlier
At least with clang-3.9 and earlier, -Wunknown-pragmas is also needed.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@315882 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-15 21:52:53 +00:00
Roman Lebedev
4b05db4286 Really do make sure that last_write_time.pass.cpp still works with old clang
I *did* try to check that such kind of an issue was not introduced
by the rL315874, but clearly i failed to finish verification.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@315876 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-15 20:46:12 +00:00
Roman Lebedev
0fdc4c9c6b Silence clang's -Wtautological-constant-compare in last_write_time.pass.cpp
Previously this broke the builders, when D38101 was committed.
Silence the warning so that it can be re-landed.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@315874 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-15 20:12:42 +00:00
Eric Fiselier
530ad8eb20 Fix equivalent test on OS X and FreeBSD
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307119 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 03:54:38 +00:00
Eric Fiselier
3288eac673 Implement LWG 2937 - equivalent("dne", "exists") is not an error
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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307117 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 03:37:05 +00:00
Eric Fiselier
706e2c7374 Diagnose when reverse_iterator is used on path::iterator.
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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300164 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 02:54:13 +00:00
Eric Fiselier
7c7df6461c Implement LWG 2787 - [file_status.cons] is inconsistent
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@297071 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-06 21:02:06 +00:00
Eric Fiselier
4203bfb5d3 add tests for ENAMETOOLONG
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@295390 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-17 01:00:37 +00:00
Michal Gorny
6c7c93f95a [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294431 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-08 09:57:32 +00:00
Stephan T. Lavavej
19ab479cc2 [libcxx] [test] Fix comment typos.
No functional change, no code review.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294160 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 22:48:20 +00:00
Saleem Abdulrasool
7566869dab 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294127 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 17:21:52 +00:00
Stephan T. Lavavej
16e2ba19df [libcxx] [test] Fix comment typos, strip trailing whitespace.
No functional change, no code review.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292434 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-18 20:10:25 +00:00
Eric Fiselier
f2b48899a5 Fix filesystem::path assignment from {}
Adding `path::operator=(string_type&&)` made the expression `p = {}`
ambiguous. This path fixes that ambiguity by making the `string&&`
overload a template so it ranks lower during overload resolution.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292345 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-18 05:48:55 +00:00