Commit Graph

234 Commits

Author SHA1 Message Date
Zoe Carver 6585f018ad [libc++] std::abs should not return double
Implement LWG Issue 2735 by adding std::abs
tests for several types and checking their
return value. NFC.

llvm-svn: 369394
2019-08-20 15:43:25 +00:00
Marshall Clow 7afe9ea96f Add tests for regex_match ambiguity (aka LWG2273). NFC. Reviewed as https://reviews.llvm.org/D63051
llvm-svn: 365080
2019-07-03 20:32:35 +00:00
Marshall Clow 3c125fe821 Implement LWG2221: 'Formatted output for nullptr_t' Reviewed as: https://reviews.llvm.org/D63053
llvm-svn: 364802
2019-07-01 16:20:25 +00:00
Marshall Clow 5347024e28 Update issue statuses. Reviewed as https://reviews.llvm.org/D62932
llvm-svn: 362659
2019-06-05 21:52:19 +00:00
Eric Fiselier 1670772adc Fix implementation of ::abs and std::abs LWG 2192.
Summary:
All overloads of `::abs` and `std::abs` must be present in both `<cmath>` and `<cstdlib>`. This is problematic to implement because C defines `fabs` in `math.h` and `labs` in `stdlib.h`. This introduces a circular dependency between the two headers. 

This patch implements that requirement by moving `abs` into `math.h` and making `stdlib.h` include `math.h`. In order to get the underlying C declarations from the "real" `stdlib.h` inside our `math.h` we need some trickery. Specifically we need to make `stdlib.h` include next itself.

Suggestions for a cleaner implementation are welcome.

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: krytarowski, fedor.sergeev, dexonsmith, jdoerfert, jsji, libcxx-commits

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

llvm-svn: 359020
2019-04-23 18:01:58 +00:00
Louis Dionne 6c49e1ce26 [libc++] Use std::is_nothrow_callable for std::invoke according to LWG 2807
Thanks to Zoe Carver for the patch.
Differential Revision: https://reviews.llvm.org/D58097

llvm-svn: 357616
2019-04-03 17:54:37 +00:00
Marshall Clow 7b4ab3b9e4 Mark several issues (and one paper) as complete. Reviewed as D58099; but I added LWG3101 and LWG3144 and P1357R1 as well.
llvm-svn: 354898
2019-02-26 17:01:00 +00:00
James Y Knight 5d71fc5d7b Adjust documentation for git migration.
This fixes most references to the paths:
 llvm.org/svn/
 llvm.org/git/
 llvm.org/viewvc/
 github.com/llvm-mirror/
 github.com/llvm-project/
 reviews.llvm.org/diffusion/

to instead point to https://github.com/llvm/llvm-project.

This is *not* a trivial substitution, because additionally, all the
checkout instructions had to be migrated to instruct users on how to
use the monorepo layout, setting LLVM_ENABLE_PROJECTS instead of
checking out various projects into various subdirectories.

I've attempted to not change any scripts here, only documentation. The
scripts will have to be addressed separately.

Additionally, I've deleted one document which appeared to be outdated
and unneeded:
  lldb/docs/building-with-debug-llvm.txt

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

llvm-svn: 352514
2019-01-29 16:37:27 +00:00
Louis Dionne 7c7cac05ed [NFC] Replace C++1y and C++1z by C++14 and C++17, respectively
llvm-svn: 345762
2018-10-31 18:53:31 +00:00
Louis Dionne 534900b12e [NFC] Mark "Splicing Maps and Sets" as done in LLVM 8.0
llvm-svn: 345759
2018-10-31 18:33:11 +00:00
Volodymyr Sapsai 8d6ac8f689 Revert "Implement LWG 2221 - No formatted output operator for nullptr."
This reverts r342566 as it causes on bots linker errors like

> Undefined symbols for architecture i386:
>   "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(std::nullptr_t)", referenced from:

llvm-svn: 342599
2018-09-19 23:31:34 +00:00
Marshall Clow 4a71f9cfcc Implement LWG 2221 - No formatted output operator for nullptr. Reviewed as https://reviews.llvm.org/D44263
llvm-svn: 342566
2018-09-19 18:29:57 +00:00
Marshall Clow 7986a5bdf8 Mark LWG#2260 as complete. We already did the right thing, so I just added tests to ensure that we continue to DTRT.
llvm-svn: 338936
2018-08-03 23:28:48 +00:00
Marshall Clow 1f9e03f04d Final bit of P0063 - make sure that aligned_alloc is available when the underlying C library supports it
llvm-svn: 338457
2018-07-31 23:39:12 +00:00
Eric Fiselier 5090559bd4 Correctly mark the Filesystem status as complete.
llvm-svn: 338094
2018-07-27 03:16:02 +00:00
Eric Fiselier 998a5c8831 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.

llvm-svn: 338093
2018-07-27 03:07:09 +00:00
Eric Fiselier c16998649e [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

llvm-svn: 337516
2018-07-20 01:22:32 +00:00
Marshall Clow 50eae5a3e5 Mark more bits of P0433 as complete.
llvm-svn: 333058
2018-05-23 03:22:59 +00:00
Eric Fiselier d491a6960a 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.

llvm-svn: 329031
2018-04-02 23:35:24 +00:00
Eric Fiselier d7fae181c3 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.

llvm-svn: 329028
2018-04-02 23:03:41 +00:00
Marshall Clow 6d1aec1260 Implement LWG#2518 - Non-member swap for propagate_const should call member swap
llvm-svn: 327005
2018-03-08 15:01:50 +00:00
Marshall Clow 5012793e05 Implement LWG 2835 - fix <tgmath.h>
llvm-svn: 324923
2018-02-12 19:13:24 +00:00
Marshall Clow c0db07299e Implement LWG#2908 - The less-than operator for shared pointers could do more, and mark 2878 as complete as well (we already do that)
llvm-svn: 324911
2018-02-12 17:26:40 +00:00
Marshall Clow 6d9f750dec Implement deduction guide for basic_string as described in P0433
llvm-svn: 324569
2018-02-08 06:34:03 +00:00
Marshall Clow 8abbc96c18 Mark 2903 as complete; we already do this
llvm-svn: 323479
2018-01-25 22:33:17 +00:00
Marshall Clow 12e17b19ba Mark LWG2824 as complete. We already did it, but I added a test to be sure
llvm-svn: 321689
2018-01-03 04:37:30 +00:00
Marshall Clow bae5d279ed Mark issue #2866 as "nothing to do"
llvm-svn: 321687
2018-01-03 03:43:32 +00:00
Marshall Clow dd74d83f84 Implement p0258r2: has_unique_object_representations
llvm-svn: 321685
2018-01-03 02:32:28 +00:00
Marshall Clow 28f1dfcbfe A couple more inlined variables that I missed the first time
llvm-svn: 321661
2018-01-02 18:41:01 +00:00
Marshall Clow 40a01d5314 Implement most of P0607: Inline Variables for the Standard Library. This involved marking a lot of variables as inline (but only for C++17 and later).
llvm-svn: 321658
2018-01-02 17:17:01 +00:00
Marshall Clow c78e12eaf8 Add issue 2587, which was missed
llvm-svn: 319734
2017-12-05 03:51:16 +00:00
Marshall Clow d42db7e083 Implement LWG#2921 and LWG#2976 - removing allocator support from packaged_task.
llvm-svn: 319080
2017-11-27 19:43:28 +00:00
Marshall Clow 9180eb1f4a Implement p0137r1 - std::launder. Reviewed as https://reviews.llvm.org/D40144
llvm-svn: 318864
2017-11-22 19:49:03 +00:00
Stephan T. Lavavej 69c2e1336f [libcxx] [www] Manually change http links to https.
Fixes D37318.

llvm-svn: 312260
2017-08-31 17:59:42 +00:00
Stephan T. Lavavej 907c1ab603 [libcxx] [www] Semi-manually change http://www.open-std.org and http://isocpp.org papers to https://wg21.link .
Fixes D37318.

llvm-svn: 312259
2017-08-31 17:59:39 +00:00
Stephan T. Lavavej 2956ea46cd [libcxx] [www] Change http://wg21.link to https://wg21.link .
Fixes D37318.

llvm-svn: 312257
2017-08-31 17:59:33 +00:00
Marshall Clow 88c893cc33 Implement P0739R0: 'Some improvements to class template argument deduction integration into the standard library' This is an API change (not ABI change) due to a late change in the c++17 standard
llvm-svn: 309296
2017-07-27 17:44:03 +00:00
Marshall Clow 5820ae49ab Update libc++ status pages with results of the Toronto Meeting - and for C++2a
llvm-svn: 308153
2017-07-16 23:59:23 +00:00
Michael Park aeb2c881ce Mark LWG 2904 as complete.
llvm-svn: 304893
2017-06-07 10:27:17 +00:00
Marshall Clow 91a091cc00 Mark LWG#2900 as complete - we already do this, and I checked the tests in a couple days ago (r303268 & r303824)
llvm-svn: 303876
2017-05-25 16:05:54 +00:00
Eric Fiselier c81c8cbe77 Fix broken links on C++1z status page
llvm-svn: 303835
2017-05-25 04:09:07 +00:00
Marshall Clow c44a727ee4 Implement LWG#2790: Remove istreambuf_iterator::operator->. It never did anything useful.
llvm-svn: 303675
2017-05-23 18:55:32 +00:00
Marshall Clow 35f62e3228 Mark LWG#2782 as complete. No functionality change; we already do this. Just added a few more tests.
llvm-svn: 302802
2017-05-11 14:25:45 +00:00
Marshall Clow afda4a9af9 Mark LWG#2850 as complete. No functionality change; we had tests that covered it already. Just added comments to the tests. Thanks to K-ballo for the heads up.
llvm-svn: 302799
2017-05-11 13:55:20 +00:00
Marshall Clow 9630f46dde Mark LWG#2796 as complete. No functionality change; we had tests that covered it already. Just added comments to the tests
llvm-svn: 302798
2017-05-11 13:51:09 +00:00
Eric Fiselier d75e451471 Implement LWG 2591 - Patch from K-Ballo
llvm-svn: 302724
2017-05-10 20:37:43 +00:00
Marshall Clow ea9c5465dc Mark LWG#2788 as complete - we already do this
llvm-svn: 300568
2017-04-18 17:22:49 +00:00
Marshall Clow f0d59405f0 Mark LWG#2853 as complete. No code changes required, but added a couple of extra tests
llvm-svn: 300449
2017-04-17 13:19:14 +00:00
Eric Fiselier 4727272254 Overhaul unique_ptr - Implement LWG 2801, 2905, 2520.
This patch overhauls both specializations of unique_ptr while implementing
the following LWG issues:

* LWG 2801 - This issue constrains unique_ptr's constructors when the deleter type
  is not default constructible. Additionally it adds SFINAE conditions
  to unique_ptr<T[]>::unique_ptr(Up).

* LWG 2905 - This issue reworks the unique_ptr(pointer, /* see below */ deleter)
  constructors so that they correctly SFINAE when the deleter argument cannot
  be used to construct the stored deleter.

* LWG 2520 - This issue fixes initializing unique_ptr<T[]> from nullptr.
  Libc++ had previously implemented this issue, but the suggested resolution
  still broke initialization from NULL. This patch re-works the
  unique_ptr<T[]>(Up, deleter) overloads so that they accept NULL as well
  as nullptr.

llvm-svn: 300406
2017-04-16 01:51:04 +00:00
Eric Fiselier 2551475596 Implement LWG 2857 for variant. Tests from Casey Carter @ Microsoft.
Also mark LWG 2857 as complete, since the changes to optional and
any were completed by Marshall earlier.

llvm-svn: 300403
2017-04-15 19:32:02 +00:00