summaryrefslogtreecommitdiffstats
path: root/libcxx/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Make std::experimental::filesystem::remove and remove_all return false or 0 ↵Ekaterina Vaartis2018-01-111-4/+11
| | | | | | | | if the file doesn't exist Differential Revision: https://reviews.llvm.org/D41830 llvm-svn: 322293
* [libcxx] Suppress unused warning on apple.Don Hinton2017-12-251-0/+1
| | | | | | | | | | | | | | | | Summary: This warning is already suppressed on non-apple platforms, so this change just suppresses it on apple as well. Reviewers: EricWF, lichray Reviewed By: lichray Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41248 llvm-svn: 321435
* [libcxx] Add WebAssembly supportSam Clegg2017-12-161-1/+1
| | | | | | | | | | | | It turns out that this is the only change required in libcxx for it to compile with the new `wasm32-unknown-unknown-wasm` target recently added to Clang. Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D41073 llvm-svn: 320925
* [libcxx] Support getentropy as a source of randomness for std::random_devicePetr Hosek2017-12-011-2/+27
| | | | | | | | | | Use this source use on Fuchsia where this is the oficially way to obtain randomness. This could be also used on other platforms that already support getentropy such as *BSD or Linux. Differential Revision: https://reviews.llvm.org/D40319 llvm-svn: 319523
* Allow to set locale on Windows.Martin Storsjo2017-11-231-15/+1
| | | | | | | | | | | | | | | Fix the problem PR31516 with setting locale on Windows by wrapping _locale_t with a pointer-like class. Reduces 74 test failures in std/localization test suite to 47 test failures (on llvm clang, Visual Studio 2015). Number of test failures doesn't depend on the platform (x86 or x64). Patch by Andrey Khalyavin. Differential Revision: https://reviews.llvm.org/D40181 llvm-svn: 318902
* Fix PR35078 - recursive directory iterator's increment method throws ↵Eric Fiselier2017-10-301-9/+28
| | | | | | | | | | | | | | 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. llvm-svn: 316939
* [libc++] Support Microsoft ABI without vcruntime headersShoaib Meenai2017-10-093-19/+101
| | | | | | | | | | | | | | | | | The vcruntime headers are hairy and clash with both libc++ headers themselves and other libraries. libc++ normally deals with the clashes by deferring to the vcruntime headers and silencing its own definitions, but for clients which don't want to depend on vcruntime headers, it's desirable to support the opposite, i.e. have libc++ provide its own definitions. Certain operator new/delete replacement scenarios are not currently supported in this mode, which requires some tests to be marked XFAIL. The added documentation has more details. Differential Revision: https://reviews.llvm.org/D38522 llvm-svn: 315234
* [libc++] Replace __sync_* functions with __libcpp_atomic_* functionsWeiming Zhao2017-09-197-12/+34
| | | | | | | | | | | | | | | | Summary: This patch replaces __sync_* with __libcpp_atomic_* and adds a wrapper function for __atomic_exchange to support _LIBCPP_HAS_NO_THREADS. Reviewers: EricWF, jroelofs, mclow.lists, compnerd Reviewed By: EricWF, compnerd Subscribers: compnerd, efriedma, cfe-commits, joerg, llvm-commits Differential Revision: https://reviews.llvm.org/D35235 llvm-svn: 313694
* typeinfo: provide a partial implementation for Win32Saleem Abdulrasool2017-09-152-4/+69
| | | | | | | | | | | | | | | | | The RTTI structure is different on Windows when building under MS ABI. Update the definition to reflect this. The structure itself contains an area for caching the undecorated name (which is 0-initialized). The decorated name has a bitfield followed by the linkage name. When std::type_info::name is invoked for the first time, the runtime should undecorate the name, cache it, and return the undecorated name. This requires access to an implementation of __unDName. For now, return the raw name. This uses the fnv-1a hash to hash the name of the RTTI. We could use an alternate hash (murmur? city?), but, this was the quickest to throw together. llvm-svn: 313344
* Make pbump (internally) handle sizes bigger than MAX_INT. Fixes PR#33725 - ↵Marshall Clow2017-09-121-3/+3
| | | | | | thanks to Jonathan Wakely for the report llvm-svn: 313031
* [libc++] Don't hardcode namespace in manual manglingShoaib Meenai2017-08-071-8/+12
| | | | | | | | | libc++'s inline namespace can change depending on the ABI version. Instead of hardcoding __1 in the manual Microsoft ABI manglings for the iostream globals, stringify _LIBCPP_NAMESPACE and use that instead, to work across all ABI versions. llvm-svn: 310290
* Rename a couple variables to eliminate a shadow warning. No functionality changeMarshall Clow2017-08-021-11/+11
| | | | llvm-svn: 309881
* Rework libcxx strerror_r handling.James Y Knight2017-07-191-26/+46
| | | | | | | | | | | | | | | The set of #ifdefs used to handle the two incompatible variants of strerror_r were not complete (they didn't handle newlib appropriately). Rather than attempting to make the ifdefs more complex, make them unnecessary by choosing which behavior to use dependent upon the return type. Reviewers: waltl Differential Revision: https://reviews.llvm.org/D34294 llvm-svn: 308528
* Remove <__refstring> header; Move it into source directory.Eric Fiselier2017-07-122-1/+128
| | | | | | | | | | | | | | | | | | | | The libc++ <__refstring> headers has no real reason why it should be a public header that libc++ ships. The only reason it was in the include directory was because libc++abi needed it to build the library. However keeping <__refstring> a header had other problems, like requiring its dependancies to also be in the headers. For that reason this patch moves it into the source directory. To work around libc++abi's need for this header a duplicated copy was added to libc++abi in r307748. While duplicating the code is an unfortunate solution it's the best solution that's currently possible. In the future I would like to start a discussion on the mailing lists about making libc++abi build as a sub-project of libc++, requiring the libc++ sources always be present. llvm-svn: 307749
* Revert "[libc++] Refactoring __sync_* builtins; NFC (Reland)"Eric Fiselier2017-07-123-11/+8
| | | | | | | This reverts commit r307595. The commit had some issues that needed to first be addressed in review. llvm-svn: 307746
* [libc++] Refactoring __sync_* builtins; NFC (Reland)Weiming Zhao2017-07-103-8/+11
| | | | | | | | | | | | Summary: Wrap __sync_* builtins with __libcpp_ functions to facility future customizations as atomic operations are unavailable on some targets. Reviewers: danalbert, EricWF, jroelofs Subscribers: joerg, llvm-commits Differential Revision: https://reviews.llvm.org/D34918 llvm-svn: 307595
* Revert "[libc++] Refactoring __sync_* builtins; NFC"Weiming Zhao2017-07-103-10/+8
| | | | | | This reverts commit 72ff8866bca49ee7d24c87673293b4ce88a039ec. llvm-svn: 307593
* [libc++] Refactoring __sync_* builtins; NFCWeiming Zhao2017-07-103-8/+10
| | | | | | | | | | | | Summary: Wrap __sync_* builtins with __libcpp_ functions to facility future customizations as atomic operations are unavailable on some targets. Reviewers: danalbert, EricWF, jroelofs Subscribers: joerg, llvm-commits Differential Revision: https://reviews.llvm.org/D34918 llvm-svn: 307591
* Fix filesystem build on platforms with weird time_t types.Eric Fiselier2017-07-082-144/+181
| | | | | | | | | | | | | | 32-bit powerpc provides a 64 bit time_t type and older ppc64 systems provide time_t as a floating point type. This caused problems when building operations.cpp since operations.cpp contained compile time tests for conversions between time_t and filesystem time type. When these tests failed they caused the libc++ build to fail as well. This is unfortunate. This patch moves the tests out of the source file and into the test suite. It also expands the tests to allow testing of the weird time_t configurations on all platforms. llvm-svn: 307461
* Implement LWG 2937 - equivalent("dne", "exists") is not an errorEric Fiselier2017-07-051-6/+9
| | | | | | | | | | | | | | 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. llvm-svn: 307117
* path: Use string_view_t consistentlyDuncan P. N. Exon Smith2017-06-191-2/+3
| | | | | | | | | Most of filesystem/path.cpp uses string_view_t. This fixes the two spots that use string_view directly. https://reviews.llvm.org/D34332 llvm-svn: 305661
* Fix potential bug by casting to the POSIX specified typeEric Fiselier2017-06-161-1/+1
| | | | llvm-svn: 305549
* Move external instantiation for __vector_base_common to vector.cppEric Fiselier2017-06-152-2/+16
| | | | | | | | Previously the explicit instantiation for this was in locale.cpp, but that didn't make much sense. This patch creates a new vector.cpp source file to contain the explicit instantiation. llvm-svn: 305442
* Fix Libc++ build with MinGW64Eric Fiselier2017-05-316-16/+29
| | | | | | | | | | | | | | Summary: This patch corrects the build errors I encountered when building on MinGW64. Reviewers: mati865, rnk, compnerd, smeenai, bcraig Reviewed By: mati865, smeenai Subscribers: martell, chapuni, cfe-commits Differential Revision: https://reviews.llvm.org/D33082 llvm-svn: 304360
* [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier2017-05-315-0/+5
| | | | | | | | | | | | | | | | Summary: This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning. This patch changes libc++ to use `#pragma push_macro` to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header. Reviewers: mclow.lists, bcraig, compnerd, EricWF Reviewed By: EricWF Subscribers: cfe-commits, krytarowski Differential Revision: https://reviews.llvm.org/D33080 llvm-svn: 304357
* Remove usages of _LIBCPP_MSVC which is never definedEric Fiselier2017-05-102-2/+2
| | | | llvm-svn: 302736
* [libc++] Refactor Windows support headers.Eric Fiselier2017-05-102-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch refactors and tries to remove as much of the Windows support headers as possible. This is needed because they currently introduce super weird include cycles and dependencies between STL and libc headers. The changes in this patch are: * remove `support/win32/support.h` completely. The required parts have either been moved into `support/win32/msvc_support.h` (for `MSVC` only helpers not needed by Clang), or directly into their respective `foo.h` headers. * Combine `locale_win32.h` and `locale_mgmt_win32.h` into a single headers, this header should only be included within `__locale` or `locale` to avoid include cycles. * Remove the unneeded parts of `limits_win32.h` and re-name it to `limits_msvc_win32.h` since it's only needed by Clang. I've tested this patch using Clang on Windows, but I suspect it might technically regress our non-existent support for MSVC. Is somebody able to double check? This refactor is needed to support upcoming fixes to `<locale>` on Windows. Reviewers: bcraig, rmaprath, compnerd, EricWF Reviewed By: EricWF Subscribers: majnemer, cfe-commits Differential Revision: https://reviews.llvm.org/D32988 llvm-svn: 302727
* Refactor <locale> RAII guards to aid upcoming Windows locale changes.Eric Fiselier2017-05-082-27/+45
| | | | | | | | | | | | | | | | | | | Previously <locale> used std::unique_ptr<remove_ptr<locale_t>, locale-mgmt-function> as a scope guard for (A) creating new locales, and (B) setting the thread specific locale in RAII safe manner. However using unique_ptr has some problems, first it requires that locale_t is a pointer type, which may not be the case (Windows will need a non-pointer locale_t type that emulates _locale_t). The second problem is that users of the guards had to supply the locale management function to the custom deleter at every call site. However these locale management functions don't exist natively Windows, making a good Windows implementation of locale more difficult. This patch creates distinct and simply RAII guards that replace unique_ptr. These guards handle calling the correct locale management function so that callers don't have too. This simplification will aid in upcoming Windows fixes. llvm-svn: 302474
* [libc++] Implement exception_ptr on WindowsEric Fiselier2017-05-082-1/+95
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements exception_ptr on Windows using the `__ExceptionPtrFoo` functions provided by MSVC. The `__ExceptionPtrFoo` functions are defined inside the C++ standard library, `msvcprt`, which is unfortunate because it requires libc++ to link to the MSVC STL. However this doesn't seem to cause any immediate problems. However to be safe I kept all usages within the libc++ dylib so that user programs wouldn't have to link to MSVCPRT as well. Note there are still 2 outstanding exception_ptr/nested_exception test failures. * `current_exception.pass.cpp` needs to be rewritten for the Windows exception_ptr semantics which copy the exception every time. * `rethrow_if_nested.pass.cpp` need investigation. It hits a stack overflow, likely from recursion. This patch also gets most of the `<future>` tests passing as well. Reviewers: mclow.lists, compnerd, bcraig, rmaprath, majnemer, BillyONeal, STL_MSFT Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D32927 llvm-svn: 302393
* Fix remaining GCC 7 build warningsEric Fiselier2017-05-051-2/+2
| | | | llvm-svn: 302283
* Fix new warnings emitted by GCC 7Eric Fiselier2017-05-051-6/+6
| | | | llvm-svn: 302280
* Fix incorrect usage of __libcpp_mutex_trylock. Patch from Andrey KhalyavinEric Fiselier2017-05-041-1/+1
| | | | llvm-svn: 302129
* Use nullptr instead of the literal 0Eric Fiselier2017-05-041-2/+2
| | | | llvm-svn: 302100
* [libc++] Use _LIBCPP_ABI_MICROSOFT instead of _MSC_VERShoaib Meenai2017-04-191-8/+8
| | | | | | | | _LIBCPP_ABI_MICROSOFT is more appropriate to use here, since the conditionals are controlling Microsoft mangling. It wasn't used originally since it didn't exist at the time. llvm-svn: 300743
* [libc++] Drop support for CRTs older than VS 2015Shoaib Meenai2017-04-072-11/+2
| | | | | | | | | | | LLVM dropped support for Visual Studio versions older than 2015 quite some time ago, so I consider it safe to drop libc++'s support for older CRTs. The CRT in Visual Studio 2015 provides a lot of previously missing functions, so targeting it requires less special casing. Differential Revision: https://reviews.llvm.org/D31798 llvm-svn: 299743
* [libc++] Add a key function for bad_function_callShoaib Meenai2017-03-281-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: bad_function_call is currently an empty class, so any object files using that class will end up with their own copy of its typeinfo, typeinfo name and vtable, leading to unnecessary duplication that has to be resolved by the dynamic linker. Instead, give bad_function_call a key function and put a definition for that key function in libc++ itself, to centralize the typeinfo and vtable. This is consistent with the behavior for other exception classes. The key functions are defined in libc++ rather than libc++abi since the class is defined in the libc++ versioning namespace, so ABI compatibility with libstdc++ is not a concern. Guard this change behind an ABI macro, since it isn't backwards compatible (i.e., clients built against the new libc++ headers wouldn't be able to run against an older libc++ library). Reviewers: mclow.lists, EricWF Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D27387 llvm-svn: 298937
* Fix PR32183 - Wrap GCC exception implementation in missing namespace stdEric Fiselier2017-03-082-1/+5
| | | | llvm-svn: 297306
* [libc++] Add option to disable new/delete overloads when libc++abi provides ↵Eric Fiselier2017-03-021-2/+3
| | | | | | | | | | | | | | | | | | | | | them. Summary: Currently both libc++ and libc++abi provide definitions for operator new/delete. However I believe this is incorrect and that one or the other should offer them. This patch adds the CMake option `-DLIBCXX_ENABLE_NEW_DELETE_DEFINITIONS` which defaults no `ON` unless `-DLIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS=ON` is specified. Reviewers: mclow.lists, mehdi_amini, dexonsmith, danalbert, smeenai, mgorny, rmaprath Reviewed By: mehdi_amini Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30516 llvm-svn: 296802
* [libcxx] Support threads on FuchsiaPetr Hosek2017-03-011-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D30278 llvm-svn: 296573
* Remove a now unneeded __CloudABI__ check.Ed Schouten2017-02-111-2/+0
| | | | | | | CloudABI has gained the setlocale() function in the meantime, meaning there is no longer a need to conditionalize this. llvm-svn: 294833
* Fix the build of thread.cpp on CloudABI.Ed Schouten2017-02-111-2/+2
| | | | | | | CloudABI does provide unistd.h, but doesn't define __unix__. We need to include this header file to make hardware_concurrency work. llvm-svn: 294832
* Fix yet another Apple buildit bugEric Fiselier2017-02-101-1/+3
| | | | llvm-svn: 294732
* Attempt to fix Apple buildit botsEric Fiselier2017-02-101-1/+5
| | | | llvm-svn: 294731
* Recommit "Split exception.cpp and new.cpp implementation into different ↵Eric Fiselier2017-02-1012-498/+687
| | | | | | | | | | | | | | | | | | | | | | files for different runtimes." This recommits r294707 with additional fixes. The main difference is libc++ now correctly builds without any ABI library. exception.cpp is a bloody mess. It's full of confusing #ifdef branches for each different ABI library we support, and it's getting unmaintainable. This patch breaks down exception.cpp into multiple different header files, roughly one per implementation. Additionally it moves the definitions of exceptions in new.cpp into the correct implementation header. This patch also removes an unmaintained libc++abi configuration. This configuration may still be used by Apple internally but there are no other possible users. If it turns out that Apple still uses this configuration internally I will re-add it in a later commit. See http://llvm.org/PR31904. llvm-svn: 294730
* Revert "Split exception.cpp and new.cpp implementation into different files ↵Eric Fiselier2017-02-1012-686/+498
| | | | | | | | for different runtimes." The compiler-rt CMake configuration needs some tweaking before this can land. llvm-svn: 294727
* Split exception.cpp and new.cpp implementation into different files for ↵Eric Fiselier2017-02-1012-498/+686
| | | | | | | | | | | | | | | | | | | different runtimes. exception.cpp is a bloody mess. It's full of confusing #ifdef branches for each different ABI library we support, and it's getting unmaintainable. This patch breaks down exception.cpp into multiple different header files, roughly one per implementation. Additionally it moves the definitions of exceptions in new.cpp into the correct implementation header. This patch also removes an unmaintained libc++abi configuration. This configuration may still be used by Apple internally but there are no other possible users. If it turns out that Apple still uses this configuration internally I will re-add it in a later commit. See http://llvm.org/PR31904. llvm-svn: 294707
* Threading support: externalize sleep_for() function.Asiri Rathnayake2017-02-091-26/+2
| | | | | | | | | | Different platforms implement the wait/sleep functions in difrerent ways. It makes sense to externalize this into the threading API. Differential revision: https://reviews.llvm.org/D29630 Reviewers: EricWF, joerg llvm-svn: 294573
* Fix bugs in filesystem detected by _LIBCPP_ASSERT.Eric Fiselier2017-02-072-7/+16
| | | | | | | | | | | | | | | | | Recently I turned on libc++'s debug mode assertions when CMake is configured with -DLIBCXX_ENABLE_ASSERTIONS=ON. This change exposed assertion failures caused by bugs in filesystem. This patch fixes those failures. The first bug was that `PathParser` was using front()/back() on empty string views in order to get the address of the character. However this is UB on empty strings. Those operations now use data() to obtain the pointer. The second bug was that directory_iterator attempted to capture errno when it was unset and there was an assertion to detect this. llvm-svn: 294360
* filesystem: return the constructed objectSaleem Abdulrasool2017-02-071-5/+2
| | | | | | | | This really should get identified properly by the compiler to convert to a NVRO, but compress the code anyways. This makes the implementation identical to directory_iterator.cpp llvm-svn: 294270
* Refer to _LIBCPP_MSVC macro where applicableSaleem Abdulrasool2017-02-063-8/+8
| | | | | | | | | Replace preprocess conditions of defined(_MSC_VER) && !defined(__clang__) with defined(_LIBCPP_MSVC). NFC. Patch by Dave Lee! llvm-svn: 294171
OpenPOWER on IntegriCloud