summaryrefslogtreecommitdiffstats
path: root/libcxx/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Be more consistent about which bool value means an error occurredEric Fiselier2018-07-261-6/+6
| | | | llvm-svn: 338002
* Cleanup the last_write_time internalsEric Fiselier2018-07-262-17/+26
| | | | llvm-svn: 338001
* Fix attribute placement WRT extern CEric Fiselier2018-07-261-2/+2
| | | | llvm-svn: 337999
* [libc++] Add hack to allow ubsan to work w/o compiler-rt (__muloti4 is ↵Eric Fiselier2018-07-261-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | undefined) Summary: Using int128_t with UBSAN causes link errors unless compiler-rt is providing the runtime library. Specifically ubsan generates calls to __muloti4 but libgcc doesn't provide a definition. In order to avoid this, and allow users to continue using sanitized versions of libc++, this patch introduces a hack. It adds a cribbed version of the compiler-rt builtin to the libc++ filesystem sources. I don't think this approach will work in the long run, but it seems OK for now. Also see: https://bugs.llvm.org/show_bug.cgi?id=30643 https://bugs.llvm.org/show_bug.cgi?id=16404 Reviewers: mclow.lists, ldionne, rsmith, jyknight, echristo Reviewed By: echristo Subscribers: dberris, cfe-commits Differential Revision: https://reviews.llvm.org/D49828 llvm-svn: 337990
* [libc++] Follow-up to r337968: use an explicit cast as suggested by EricAlex Lorenz2018-07-251-2/+4
| | | | llvm-svn: 337984
* Fix GCC build in C++14 w/o c++14 constexprEric Fiselier2018-07-251-1/+1
| | | | llvm-svn: 337974
* Fix failing test under C++14Eric Fiselier2018-07-251-2/+2
| | | | llvm-svn: 337970
* [libc++] Follow-up to r337960: specify lambda's return type to avoidAlex Lorenz2018-07-251-1/+1
| | | | | | | | | | | -Wc++11-narrowing warning on Darwin The internal CI produced the following diagnostic: error: non-constant-expression cannot be narrowed from type 'long long' to '__darwin_suseconds_t' (aka 'int') in initializer list [-Wc++11-narrowing] struct ::timeval ConvertedTS[2] = {{TS[0].tv_sec, Convert(TS[0].tv_nsec)}, ^~~~~~~~~~~~~~~~~~~~~~ llvm-svn: 337968
* Make <experimental/filesystem> compile with gcc 4.8.5Eric Fiselier2018-07-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Victor Zverovich. This fixes an error when compiling `<experimental/filesystem>` with gcc 4.8.5: ``` .../libcxx/src/experimental/filesystem/filesystem_common.h:137:34: error: redeclaration ‘T std::experimental::filesystem::v1::detail::{anonymous}::error_value() [with T = bool]’ d iffers in ‘constexpr’ constexpr bool error_value<bool>() { ^ .../libcxx/src/experimental/filesystem/filesystem_common.h:133:3: error: from previous declaration ‘T std::experimental::filesystem::v1::detail::{anonymous}::error_value() [with T = bool]’ T error_value(); ^ ``` Reviewed as https://reviews.llvm.org/D49813 llvm-svn: 337962
* [libc++] Use __int128_t to represent file_time_type.Eric Fiselier2018-07-254-188/+250
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 337960
* [windows] Fix warning about comparing ints of different signsMartin Storsjo2018-07-251-2/+3
| | | | | | | | | | | | | | This fixes a warning like this: warning: comparison of integers of different signs: 'std::__1::__libcpp_tls_key' (aka 'long') and 'DWORD' (aka 'unsigned long') [-Wsign-compare] if (*__key == FLS_OUT_OF_INDEXES) ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~ Differential Revision: https://reviews.llvm.org/D49782 llvm-svn: 337946
* Fix bugs in create_directory implementation.Eric Fiselier2018-07-251-2/+4
| | | | | | | | | | | | | | 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. llvm-svn: 337888
* Make <experimental/filesystem> explicitly require C++11.Eric Fiselier2018-07-251-2/+0
| | | | | | | | | | | | | | 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. llvm-svn: 337884
* Ensure path::iterator and PathParser share the same enumeration values.Eric Fiselier2018-07-251-11/+10
| | | | | | | | | | | | To avoid exposing implementation details, path::iterator and PathParser both implicitly used the same set of values to represent the state, but they were defined twice. This could have lead to a mismatch occuring. This patch moves all of the parser state values into the filesystem header and changes PathParser to use those value to avoid this. llvm-svn: 337883
* Handle DT_UNKNOWN correctly during directory iteration.Eric Fiselier2018-07-231-1/+4
| | | | | | | | | | 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. llvm-svn: 337768
* Recommit "Use possibly cached directory entry values when performing ↵Eric Fiselier2018-07-231-3/+4
| | | | | | | | | | | | | 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). llvm-svn: 337765
* Revert "Use possibly cached directory entry values when performing recursive ↵Eric Fiselier2018-07-231-2/+2
| | | | | | | | directory iteration." This reverts commit 04ce4aef00d3ee508327f6cf7bf1b1d200ab6238. llvm-svn: 337749
* Cleanup unnecessary conversions in filesystem.Eric Fiselier2018-07-231-2/+2
| | | | llvm-svn: 337685
* Cleanup name qualification in the filesystem internals.Eric Fiselier2018-07-233-118/+118
| | | | | | | | 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 llvm-svn: 337684
* Use possibly cached directory entry values when performing recursive ↵Eric Fiselier2018-07-231-2/+2
| | | | | | directory iteration. llvm-svn: 337669
* Work around various GCC 4.9 build errorsEric Fiselier2018-07-232-9/+14
| | | | llvm-svn: 337665
* Implement filesystem_error::what() and improve reporting.Eric Fiselier2018-07-233-373/+494
| | | | | | | | | | | 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. llvm-svn: 337664
* Workaround bug in GCC trunk.Eric Fiselier2018-07-221-4/+4
| | | | | | | | | | 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. llvm-svn: 337661
* Harden copy_file even more.Eric Fiselier2018-07-221-5/+7
| | | | | | | | | | | 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. llvm-svn: 337659
* Implement a better copy_file.Eric Fiselier2018-07-221-79/+279
| | | | | | | | | | | | | | | | | | | | 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
* adjust incorrect commentEric Fiselier2018-07-201-1/+2
| | | | llvm-svn: 337532
* Use _LIBCPP_UNREACHABLE to convince GCC that non-void functions actually ↵Eric Fiselier2018-07-201-2/+2
| | | | | | always return llvm-svn: 337519
* cleanup test assertion inside libraryEric Fiselier2018-07-201-6/+0
| | | | llvm-svn: 337517
* [libc++] Implement Directory Entry Caching -- Sort of.Eric Fiselier2018-07-203-202/+393
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix PR38160 - init_priority attribute not supported by GCC on Apple.Eric Fiselier2018-07-161-1/+12
| | | | | | | | 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. llvm-svn: 337205
* [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by ↵Louis Dionne2018-07-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | _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 llvm-svn: 336866
* Revert "[libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by ↵Louis Dionne2018-07-051-2/+2
| | | | | | | | | | | | | | | _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. llvm-svn: 336382
* [libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITYLouis Dionne2018-07-051-2/+2
| | | | | | | | | | | | | | | | | | | | 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. Reviewers: EricWF Subscribers: christof, llvm-commits, dexonsmith, erikvanderpoel, mclow.lists Differential Revision: https://reviews.llvm.org/D48892 llvm-svn: 336369
* Configure ELAST for MinGWPirama Arumuga Nainar2018-06-281-2/+2
| | | | | | | | | | | | | | Summary: Use _LIBCPP_MSVCRT_LIKE while configuring ELAST, so MinGW gets the same configuration as MSVC. Reviewers: compnerd, srhines, danalbert, mstorsjo Subscribers: christof, ldionne, cfe-commits Differential Revision: https://reviews.llvm.org/D48731 llvm-svn: 335916
* Fix embarrasing typo in uncaught_exceptions. Update tests to really test ↵Marshall Clow2018-05-291-1/+1
| | | | | | this. Thanks to Peter Klotz for calling my attention to this. llvm-svn: 333467
* Fix locale test data for GLIBC 2.27 and newer.Eric Fiselier2018-04-041-0/+1
| | | | | | | | GLIBC 2.27 changed the locale data for fr_FR and ru_RU. In particular they change the decimal and thousands separators used. This patch makes the locale tests tolerate the updated locales. llvm-svn: 329143
* Implement filesystem NB comments, relative paths, and related issues.Eric Fiselier2018-04-022-476/+647
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Implement filesystem::perm_options specified in NB comments.Eric Fiselier2018-03-261-8/+11
| | | | | | | | | | 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 llvm-svn: 328476
* Fix PR22634 - std::allocator doesn't respect over-aligned types.Eric Fiselier2018-03-221-3/+3
| | | | | | | | | | | | | | | | | | | | This patch fixes std::allocator, and more specifically, all users of __libcpp_allocate and __libcpp_deallocate, to support over-aligned types. __libcpp_allocate/deallocate now take an alignment parameter, and when the specified alignment is greater than that supported by malloc/new, the aligned version of operator new is called (assuming it's available). When aligned new isn't available, the old behavior has been kept, and the alignment parameter is ignored. This patch depends on recent changes to __builtin_operator_new/delete which allow them to be used to call any regular new/delete operator. By using __builtin_operator_new/delete when possible, the new/delete erasure optimization is maintained. llvm-svn: 328180
* Fix building libc++ with the macOS 10.13 SDK with -mmacosx-version-min=10.12 ↵Nico Weber2018-02-061-4/+29
| | | | | | | | | | | | | | | | | or lower. The 10.13 SDK always defines utimensat() (with an availability(macosx=10.13) annotation) and unconditionally defines UTIME_OMIT, so use the compile-time availability macros on Apple platforms instead. For people statically linking libc++, it might make sense to also provide an opt-in option for using __builtin_available() to dynamically check for the OS version, but for now let's do the smallest thing needed to unbreak the build. Based on a patch by Eric Fiselier <eric@efcs.ca>: https://reviews.llvm.org/D34249 Fixes PR33469. llvm-svn: 324385
* Address LWG 2849 and fix missing failure condition in copy_file.Eric Fiselier2018-02-041-10/+20
| | | | | | | Previously copy_file didn't handle the case where the input and output were the same file. llvm-svn: 324187
* Put the exception classes for experimental::optional and experimental::any ↵Marshall Clow2018-02-012-0/+39
| | | | | | back in the dylib for binary compatibility llvm-svn: 323989
* Remove <experimental/any>; use <any> instead. See ↵Marshall Clow2018-02-011-7/+0
| | | | | | https://libcxx.llvm.org/TS_deprecation.html llvm-svn: 323972
* Remove <experimental/optional>; use <optional> instead. See ↵Marshall Clow2018-02-011-6/+0
| | | | | | https://libcxx.llvm.org/TS_deprecation.html llvm-svn: 323971
* libcxx: Use vcruntime declarations for typeinfo on Windows.Peter Collingbourne2018-01-262-3/+4
| | | | | | | | | | | We need to use the vcruntime declarations on Windows to avoid an ODR violation involving rtti.obj, which provides the definition of the runtime function implementing dynamic_cast and depends on the vcruntime implementations of bad_cast and bad_typeid. Differential Revision: https://reviews.llvm.org/D42220 llvm-svn: 323491
* libcxx: Rename vasprintf function to __libcpp_vasprintf.Peter Collingbourne2018-01-232-2/+4
| | | | | | | | | | | The language standard does not define a function with this name, so it is part of the user's namespace. This change fixes a duplicate symbol error that occurs when a user attempts to define a function with this name. Differential Revision: https://reviews.llvm.org/D42405 llvm-svn: 323237
* libcxx: Move Windows threading support into a .cpp file.Peter Collingbourne2018-01-231-0/+275
| | | | | | | | | This allows us to avoid polluting the namespace of users of <thread> with the definitions in windows.h. Differential Revision: https://reviews.llvm.org/D42214 llvm-svn: 323169
* libcxx: Define set_unexpected, _get_unexpected and __uncaught_exceptions ↵Peter Collingbourne2018-01-181-3/+3
| | | | | | | | | | | | without dllimport. It turns out that the MSVC headers define these functions without dllimport even when compiling with /MD. This change fixes the resulting compile-time error. Differential Revision: https://reviews.llvm.org/D42207 llvm-svn: 322794
* libcxx: Stop using private MSVC macros in the exception implementation.Peter Collingbourne2018-01-172-43/+17
| | | | | | | | | | | Inline the provided "fallback" definitions (which seem to always be taken) that expand to __cdecl into users. The fallback definitions for the *CRTIMP* macros were wrong in the case where the CRT is being linked statically, so define our own macro as a replacement. Differential Revision: https://reviews.llvm.org/D42158 llvm-svn: 322617
* Fix some too-big local arrays. Thanks to dcdillon for the patch. Reviewed as ↵Marshall Clow2018-01-111-2/+2
| | | | | | D28217 llvm-svn: 322295
OpenPOWER on IntegriCloud