Commit Graph

4861 Commits

Author SHA1 Message Date
Marshall Clow
dfd0874465 Disable 'suggest braces' warnings for std::array in tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337808 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-24 03:41:36 +00:00
Marshall Clow
fbd3e84fa1 Implement <span>. Reviewed as https://reviews.llvm.org/D49338
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337804 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-24 03:01:02 +00:00
Alex Lorenz
4b61d89c14 Revert r337727 as it caused Darwin bot failures
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337782 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-24 00:27:31 +00:00
Eric Fiselier
b3e55b246d Handle DT_UNKNOWN correctly during directory iteration.
Unlike stat and lstat, where unknown really means we know it's something weird,
during directory iteration DT_UNKNOWN simply means that the underlying FS doesn't
support the dirent::dt_type field.

This patch fixes libc++ to correctly set the cache to empty when DT_UNKNOWN is reported.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337768 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 22:58:46 +00:00
Eric Fiselier
2c1163593f Recommit "Use possibly cached directory entry values when performing recursive directory iteration."
The initial patch didn't correctly handle systems when the dirent struct
didn't provide the d_type member. Specifically it set the cache to the incorrect state,
and claimed it was partially populated.

The updated version of this change correctly handles setting up the
cache when the file type is not known (aka file_type::none).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337765 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 22:40:41 +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
7485d577aa Revert "Use possibly cached directory entry values when performing recursive directory iteration."
This reverts commit 04ce4aef00.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337749 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 21:52:29 +00:00
Heejin Ahn
80412b50ea [CMake] Fix the setting of LIBCXX_HEADER_DIR
Reviewers: phosek

Subscribers: mgorny, christof, ldionne, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337727 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 18:58:12 +00:00
Eric Fiselier
36bf18fc64 Cleanup unnecessary conversions in filesystem.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337685 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 11:55:13 +00:00
Eric Fiselier
6826553803 Cleanup name qualification in the filesystem internals.
In most cases there is no reason why the filesystem internals
use the qualifier std:: or _VSTD::. This patch removes the unneeded
qualifiers, making the sources files more consistent

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337684 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 11:46:47 +00:00
Petr Hosek
78c3548b88 Revert "[CMake] Support statically linking dependencies only to shared or static library"
This reverts commit r337668: broke the cxxabi build when using Make.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337670 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 05:07:44 +00:00
Eric Fiselier
04ce4aef00 Use possibly cached directory entry values when performing recursive directory iteration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337669 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 04:55:57 +00:00
Petr Hosek
24acfd881a [CMake] Support statically linking dependencies only to shared or static library
Currently it's possible to select whether to statically link unwinder
or the C++ ABI library, but this option applies to both the shared
and static library. However, in some scenarios it may be desirable to
only statically link unwinder and C++ ABI library into static C++
library since for shared C++ library we can rely on dynamic linking
and linker scripts. This change enables selectively enabling or
disabling statically linking only to shared or static library.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337668 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 04:19:55 +00:00
Eric Fiselier
ba01d96cb5 Fix use of C++14 syntax in C++11 filesystem tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337666 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 03:41:46 +00:00
Eric Fiselier
a0a39e593e Work around various GCC 4.9 build errors
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337665 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 03:06:57 +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
e14f03815b Workaround bug in GCC trunk.
For some reason GCC ToT is failing to deduce the auto type for
a static data member from its initializer in some cases.

Though I'm sure the bug will be short lived, there is a trivial workaround for it.
So we might as well get the bot passing again.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337661 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-22 21:56:40 +00:00
Eric Fiselier
fb03277e63 Harden copy_file even more.
This patch removes the O_CREAT open flag when we first
attempt to open the destination file but we expect it to
already exist.

This theoretically avoids the possibility that it was removed
between when we first stat'ed it, and when we attempt to open it.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337659 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-22 21:15:15 +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
Petr Hosek
4d34ec0850 [CMake] Install C++ ABI headers into the right location
This is a follow-up to r335809 and r337118. While libc++ headers are now
installed into the right location in both standard as well as multiarch
runtimes layout, turned out C++ ABI headers are still installed into the
old location in the latter case. This change addresses that.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337630 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-20 22:45:24 +00:00
Eric Fiselier
7b1b6ca284 adjust incorrect comment
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337532 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-20 08:36:45 +00:00
Eric Fiselier
77c9cf44e3 Fix two test failures in <experimental/filesystem>
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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337520 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-20 01:51:48 +00:00
Eric Fiselier
0f8ee948c3 Use _LIBCPP_UNREACHABLE to convince GCC that non-void functions actually always return
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337519 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-20 01:44:33 +00:00
Eric Fiselier
f8bfc79ac5 cleanup test assertion inside library
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337517 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-20 01:25:06 +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
Louis Dionne
c69e1a0615 [libc++] Allow running ABI list tests with different ABI versions
Summary:
Currently, the ABI list test only works for ABI version 1. This commit
allows running the ABI list test with ABI version 2. It also adds an
ABI list file for ABI v2 on Mac OS X.

Reviewers: EricWF

Subscribers: mgorny, christof, dexonsmith, llvm-commits, mclow.lists

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337477 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-19 18:02:50 +00:00
Marshall Clow
f1f54dc0fb Update the synopsis for <chrono> for C++20. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337406 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-18 17:37:51 +00:00
Eric Fiselier
ffbb91bb64 Address "always inline function is not always inlinable" warning with GCC.
When an always_inline function is used prior to the functions definition,
the compiler may not be able to inline it as requested by the attribute.
GCC flags the `basic_string(CharT const*)` function as one such example.

This patch supresses the warning, and the problem, by moving the
definition of the string constructor to the inline declaration.
This ensures the body is available when it is first ODR used.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337235 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-17 05:48:48 +00:00
Eric Fiselier
6e089f8b10 Fix PR38160 - init_priority attribute not supported by GCC on Apple.
This patch guards the use of __attribute__((init_priority(101)))
within memory_resource.cpp when building with compilers that don't
support it. Specifically GCC on Apple platforms, and MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337205 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-16 20:01:59 +00:00
Petr Hosek
a40a6b3f6e [CMake] Use correct variable as header install prefix
This variable is already set in CMakeLists.txt but it wasn't used
which means that the headers get installed into a wrong location
when the per target runtime directory option is being used.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337118 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-15 04:09:35 +00:00
Marshall Clow
0d0b972927 Mark __equal_to 's operations as constexpr.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337087 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-14 04:15:19 +00:00
Marshall Clow
d7d3d8bc18 Mark one more __wrap_iter operation as constexpr.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337085 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-14 03:06:11 +00:00
Marshall Clow
1548d77c82 wrap _LIBCPP_HAS_NO_CXX14_CONSTEXPR in defined(...)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337028 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-13 17:31:36 +00:00
Marshall Clow
e585baf371 Shot in the dark to fix gcc 4.9 / c++11 build
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337027 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-13 17:24:59 +00:00
Marshall Clow
c005c7e34c Make internal class __wrap_iter constexpr when not using libc++'s debugging mode. Introduce a new macro _LIBCPP_CONSTEXPR_IF_NODEBUG to mark this.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337019 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-13 16:35:26 +00:00
Marshall Clow
9765ed0367 Fix a couple of 'unused variable' warnings in a vector test. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@337016 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-13 16:26:16 +00:00
Marshall Clow
fbb1e6166a Turns out that wide literals U"xxx" and u"xxx" are c++11 and later.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336880 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-12 02:55:01 +00:00
Louis Dionne
54238057d6 [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY
Summary:
We never actually mean to always inline a function -- all the uses of
the macro I could find are actually attempts to control the visibility
of symbols. This is better described by _LIBCPP_INLINE_VISIBILITY, which
is actually always defined the same.

This change is orthogonal to the decision of what we're actually going
to do with _LIBCPP_INLINE_VISIBILITY -- it just simplifies things by
having one canonical way of doing things.

Note that this commit had originally been applied in r336369 and then
reverted in r336382 because of unforeseen problems. Both of these problems
have now been fixed.

Reviewers: EricWF, mclow.lists

Subscribers: christof, dexonsmith, erikvanderpoel

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336866 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 23:14:33 +00:00
Marshall Clow
88709a3f4e Same reversed ifdef happened twice. Test fix only, NFC to the library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336856 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 21:22:13 +00:00
Marshall Clow
839b1a6ebd Fix a test #ifdef that was reversed. NFC to the library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336855 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-11 21:20:42 +00:00
Petr Hosek
f51cf5e75e [CMake] Set per-runtime library directory suffix in runtimes build
Do not use LLVM_RUNTIMES_LIBDIR_SUFFIX variable which is an internal
variable used by the runtimes build from individual runtimes, instead
set per-runtime librarhy directory suffix variable which is necessary
for the sanitized runtimes build to install libraries into correct
location.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336713 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-10 19:13:33 +00:00
Louis Dionne
bb716549f1 [libc++] Declare noop_coroutine() with _LIBCPP_INLINE_VISIBILITY
Summary:
It was defined with the right visibility, but declared without any visibility.
This function was left out of a prior revision that did the same to several
functions in <compare> (r336665) because the compiler I used didn't support
coroutines. This reinforces the need for automated checks -- there might
still be several cases of this throughout the library.

Reviewers: EricWF

Subscribers: modocache, christof, dexonsmith, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336709 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-10 17:38:30 +00:00
Eric Fiselier
7a0f119777 Remove BUILD file from google-benchmark
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336666 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-10 13:25:26 +00:00
Louis Dionne
4a5f61abcb [libc++] Declare <compare> operators with the proper visibility attribute
Summary:
Many operators in <compare> were _defined_ with the proper visibility attribute,
but they were _declared_ without any. This is not a problem until we change the
definition of _LIBCPP_INLINE_VISIBILITY to something that requires the
declaration to be decorated.

I also marked `strong_equality::operator weak_equality()` as
`_LIBCPP_INLINE_VISIBILITY`, since it seems like it had been forgotten.

This came up while trying to get rid of `__attribute__((__always_inline__))`
in favor of `__attribute__((internal_linkage))`.

Reviewers: EricWF, mclow.lists

Subscribers: christof, dexonsmith, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336665 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-10 13:21:03 +00:00
Eric Fiselier
97d4134fbc Add new string benchmarks
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336636 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-10 04:11:22 +00:00
Eric Fiselier
ffc31db661 Update google-benchark to trunk
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336635 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-10 04:02:00 +00:00
Casey Carter
8df0521f96 [test] two small cleanups:
* 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336618 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-09 23:45:09 +00:00
Casey Carter
57288eb81d type_traits: aligned_union is NOT the same as __uncvref [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336502 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-08 00:06:27 +00:00
Louis Dionne
4e7ffcaae6 Revert "[libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY"
This reverts commit r336369. The commit had two problems:
1. __pbump was marked as _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY instead of
   _LIBCPP_INLINE_VISIBILITY, which lead to two symbols being added in the
   dylib and the check-cxx-abilist failing.

2. The LLDB tests started failing because they undefine
   `_LIBCPP_INLINE_VISIBILITY`. I need to figure out why they do that and
   fix the tests before we can go forward with this change.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336382 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 18:41:50 +00:00