llvm-project/libcxx/include
Eric Fiselier 7c0ed44db0 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.

llvm-svn: 337649
2018-07-22 02:00:53 +00:00
..
experimental Fix two test failures in <experimental/filesystem> 2018-07-20 01:51:48 +00:00
ext Remove usages of _LIBCPP_MSVC which is never defined 2017-05-10 21:40:58 +00:00
support [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
CMakeLists.txt [CMake] Use correct variable as header install prefix 2018-07-15 04:09:35 +00:00
__bit_reference [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows 2017-05-31 22:07:49 +00:00
__bsd_locale_defaults.h Add system header pragma to BSD locale fallback headers. 2017-08-03 02:50:43 +00:00
__bsd_locale_fallbacks.h [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
__config wrap _LIBCPP_HAS_NO_CXX14_CONSTEXPR in defined(...) 2018-07-13 17:31:36 +00:00
__config_site.in [cmake] Add a config option LIBCXX_HAS_WIN32_THREAD_API for enforcing win32 threads 2018-01-05 20:48:29 +00:00
__debug [libc++] Introduce _LIBCPP_EXTERN_VIS to fix __libcpp_debug_function link errors 2017-01-16 21:01:00 +00:00
__errc [libc++] Lift std::errc into a separated header 2018-07-03 03:25:10 +00:00
__functional_03 [libcxx] func.wrap.func.con: Unset function before destroying anything 2018-04-25 23:38:41 +00:00
__functional_base Remove unused code from __functional_base. NFC. 2018-06-06 06:42:27 +00:00
__functional_base_03
__hash_table Fix a strict aliasing violation in map and unordered_map. 2018-06-04 20:38:23 +00:00
__libcpp_version Update version to 7.0.0svn: cmake, include files and docs 2018-01-03 15:40:29 +00:00
__locale [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
__mutex_base One more (should be) inline variable that is defined in the dylib 2018-01-02 19:23:30 +00:00
__nullptr [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
__split_buffer [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows 2017-05-31 22:07:49 +00:00
__sso_allocator Fix PR22634 - std::allocator doesn't respect over-aligned types. 2018-03-22 04:42:56 +00:00
__std_stream [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows 2017-05-31 22:07:49 +00:00
__string Fix misleading indentation; replace a couple of NULLs with nullptr. Resolves https://reviews.llvm.org/D42945 ; thanks to Bruce Mitchener for the patch. 2018-02-06 18:58:05 +00:00
__threading_support libcxx: Unbreak external thread library configuration. 2018-02-21 21:36:18 +00:00
__tree Fix a strict aliasing violation in map and unordered_map. 2018-06-04 20:38:23 +00:00
__tuple Cleanup remaining usages of _LIBCPP_HAS_NO_<c++11-feature> in tuple and utility 2017-04-19 01:23:39 +00:00
__undef_macros [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows 2017-05-31 22:07:49 +00:00
algorithm Mark __equal_to 's operations as constexpr. 2018-07-14 04:15:19 +00:00
any [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
array Implement deduction guides for <array>; Reviewed as https://reviews.llvm.org/D46964 2018-05-18 21:01:04 +00:00
atomic Mark __c11_atomic_load as const 2018-06-01 18:02:53 +00:00
bitset Fix problems with r'890 when building on machines where sizeof(size_t) != sizeof(unsigned long long) and C++03 2017-11-27 22:27:22 +00:00
cassert
ccomplex
cctype Put back the undefs that Richard removed. Boost won't build w/o these; specifically the file 'bytes_methods.h' in Apple's python framework defines these. 2016-04-04 22:49:20 +00:00
cerrno
cfenv
cfloat
chrono Update the synopsis for <chrono> for C++20. No functional change. 2018-07-18 17:37:51 +00:00
cinttypes
ciso646
climits
clocale
cmath [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
codecvt [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
compare [libc++] Declare <compare> operators with the proper visibility attribute 2018-07-10 13:21:03 +00:00
complex [libcxx] Improve accuracy of complex asinh and acosh 2018-02-19 15:41:36 +00:00
complex.h
condition_variable [libc++] Make _LIBCPP_TYPE_VIS export members 2017-03-02 03:22:18 +00:00
csetjmp
csignal
cstdarg
cstdbool
cstddef Implement LWG2950: std::byte operations are misspecified 2017-11-14 01:14:53 +00:00
cstdint
cstdio [libc++] Drop support for CRTs older than VS 2015 2017-04-07 02:20:52 +00:00
cstdlib [libc++] Respect Windows Store app CRT restrictions 2017-04-06 04:47:49 +00:00
cstring Fix overload sets of strchr, strpbrk, strrchr, memchr and strstr from 2016-02-10 00:59:02 +00:00
ctgmath
ctime
ctype.h [libc++] Refactor Windows support headers. 2017-05-10 20:57:45 +00:00
cwchar [libc++] Remove unnecessary MSVCRT exclusions 2016-11-08 03:31:42 +00:00
cwctype
deque Implement deduction guides for <deque> 2018-05-18 23:44:13 +00:00
errno.h Cleanup foo.h headers and __config to work in C 2015-11-06 06:30:12 +00:00
exception [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
float.h Cleanup foo.h headers and __config to work in C 2015-11-06 06:30:12 +00:00
forward_list Fix PR37694 - std::vector doesn't correctly move construct allocators. 2018-06-05 22:32:52 +00:00
fstream Implement a better copy_file. 2018-07-22 02:00:53 +00:00
functional [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
future [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
initializer_list [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
inttypes.h [include] Declare __STDC_*_MACROS for C++11 compat in old libc 2016-09-26 20:20:00 +00:00
iomanip Move 'quoted' for string_view from <string_view> to <iomanip> (where the other versions of 'quoted' live. No functional change. 2016-10-27 15:10:07 +00:00
ios [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
iosfwd [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS 2017-01-04 23:56:00 +00:00
iostream
istream [libcxx] Make std::basic_istream::get 0-terminate input array in case of error. 2018-01-11 23:23:49 +00:00
iterator Mark one more __wrap_iter operation as constexpr. 2018-07-14 03:06:11 +00:00
limits Fix more unreserved names 2017-06-01 02:29:37 +00:00
limits.h [libcxx] Fix gcc build. 2016-10-10 15:56:01 +00:00
list Fix PR37694 - std::vector doesn't correctly move construct allocators. 2018-06-05 22:32:52 +00:00
locale [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
locale.h [libcxx] Implement locale.h to fix modules build 2016-11-19 01:14:15 +00:00
map Fix a strict aliasing violation in map and unordered_map. 2018-06-04 20:38:23 +00:00
math.h [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
memory [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
module.modulemap [libc++] Lift std::errc into a separated header 2018-07-03 03:25:10 +00:00
mutex 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). 2018-01-02 17:17:01 +00:00
new [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
numeric Fix incorrect handling of move-only types in transform_reduce iter iter iter init, and add test. 2018-01-05 01:31:57 +00:00
optional Add deduction guides for optional 2018-05-25 02:08:49 +00:00
ostream [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
queue Deduction guides for the container adaptors - queue, stack, and priority_queue 2018-05-22 01:57:53 +00:00
random Change an internal table of constants for the poisson distribution from 2018-01-16 14:54:36 +00:00
ratio 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). 2018-01-02 17:17:01 +00:00
regex [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
scoped_allocator More of P0600; marking allocation routines as [[nodiscard]] 2017-11-26 02:55:38 +00:00
set Use multi-key tree search for {map, set}::{count, equal_range} 2018-02-10 02:53:47 +00:00
setjmp.h Cleanup foo.h headers and __config to work in C 2015-11-06 06:30:12 +00:00
shared_mutex [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows 2017-05-31 22:07:49 +00:00
sstream libcxx: Fix for basic_stringbuf::seekoff() after r320604. 2017-12-19 23:33:16 +00:00
stack Deduction guides for the container adaptors - queue, stack, and priority_queue 2018-05-22 01:57:53 +00:00
stdbool.h Add stdbool.h wrapper for libc++ 2016-02-20 00:16:41 +00:00
stddef.h Check for musl-libc's max_align_t in addition to other variants. 2017-02-10 01:27:42 +00:00
stdexcept [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
stdint.h [include] Declare __STDC_*_MACROS for C++11 compat in old libc 2016-09-26 20:20:00 +00:00
stdio.h libcxx: Rename vasprintf function to __libcpp_vasprintf. 2018-01-23 18:53:33 +00:00
stdlib.h [libc++] Refactor Windows support headers. 2017-05-10 20:57:45 +00:00
streambuf [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
string Address "always inline function is not always inlinable" warning with GCC. 2018-07-17 05:48:48 +00:00
string.h Instead of asking glibc to provide correct C++ signatures for <string.h> 2016-02-11 23:51:02 +00:00
string_view Implement LWG3034: P0767R1 breaks previously-standard-layout types 2018-03-21 00:36:05 +00:00
strstream Cleanup _LIBCPP_HAS_NO_<c++11-feature> in the input.output library 2017-04-18 23:38:41 +00:00
system_error [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
tgmath.h Implement LWG 2835 - fix <tgmath.h> 2018-02-12 19:13:24 +00:00
thread Implement LWG 3039 and 3041 - 'Treating Unnecessary decay'. 2018-03-20 22:37:37 +00:00
tuple Implement P0777: Treating unnecessay decay 2018-02-06 20:56:55 +00:00
type_traits type_traits: aligned_union is NOT the same as __uncvref [NFC] 2018-07-08 00:06:27 +00:00
typeindex [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS 2017-01-04 23:56:00 +00:00
typeinfo [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
unordered_map Fix a strict aliasing violation in map and unordered_map. 2018-06-04 20:38:23 +00:00
unordered_set First part of P0600 - '[[nodiscard] in the standard library'. Mark the 'empty()' methods of all the containers as nodiscard. If you're calling empty() w/o looking at the result, you probably meanto to call 'clear()'. c++2a only 2017-11-15 05:51:26 +00:00
utility [NFC] Add <initializer_list> to the synopsis of <utility> 2018-07-05 16:16:03 +00:00
valarray Fix PR22634 - std::allocator doesn't respect over-aligned types. 2018-03-22 04:42:56 +00:00
variant Partially Revert "Workaround GCC bug PR78489 - SFINAE order is not respected." 2018-03-23 23:42:30 +00:00
vector [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
version Implement P0754R2: The <version> header. 2018-04-03 15:48:24 +00:00
wchar.h [libc++] Account for Microsoft CRT const overloads 2017-09-15 18:49:34 +00:00
wctype.h