summaryrefslogtreecommitdiffstats
path: root/libcxx/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Restore the _NOEXCEPT on the dtor of bad_optional_access. Destructors are ↵Marshall Clow2017-02-051-2/+2
| | | | | | noexcept by default, so it's not really needed, but the other exception classes have the _NOEXCEPT, and gcc complains if these are missing. I think we should remove them all - but not today. llvm-svn: 294142
* Change the base class of std::bad_optional_access. This is a (subtle) ABI ↵Marshall Clow2017-02-051-2/+6
| | | | | | change, and is in response to http://http://wg21.link/LWG2806, which I *expect* to be adopted in Kona. I am making this change now in anticipation, and will get it into 4.0, because (a) 4.0 is the first release with std::optional, and (b) I don't want to make an ABI-change later, when the user base should be significantly larger. Note that I didn't change std::experimental::bad_optional_access, because that's still specified to derive from std::logic_error. llvm-svn: 294133
* filesystem: fix n4100 conformance for `temp_directory_path`Saleem Abdulrasool2017-02-051-14/+19
| | | | | | | | | N4100 states that an error shall be reported if `!exists(p) || !is_directory(p)`. We were missing the first half of the conditional. Invert the error and normal code paths to make the code easier to follow. llvm-svn: 294127
* Recommit [libcxx] Never use <cassert> within libc++Eric Fiselier2017-02-044-11/+5
| | | | | | | | | | It is my opinion that libc++ should never use `<cassert>`, including in the `dylib`. This patch remove all uses of `assert` from within libc++ and replaces most of them with `_LIBCPP_ASSERT` instead. Additionally this patch turn `LIBCXX_ENABLE_ASSERTIONS` off by default, because the standard library should not be aborting user programs unless explicitly asked to. llvm-svn: 294107
* experimental: avoid using raw _WIN32 in filesystemSaleem Abdulrasool2017-01-301-5/+6
| | | | | | | Use the _LIBCPP_WIN32API macro instead of _WIN32 checks. Fix a missed renaming for style conformance. llvm-svn: 293543
* experimental: port directory_iterator to WindowsSaleem Abdulrasool2017-01-301-0/+72
| | | | | | | | | This adds a basic first cut implementation for directory_iterator on Windows. It uses the FindFirstFile/FindNextFile which has the same restrictions as opendir/readdir where there exists a TOCTOU race condition. llvm-svn: 293531
* experimental: add missing file headerSaleem Abdulrasool2017-01-301-0/+9
| | | | | | | The directory_iterator implementation file was missing the file header. Add one. NFC. llvm-svn: 293530
* experimental: inline single use of a typedefSaleem Abdulrasool2017-01-301-4/+1
| | | | | | | The typedef is not particularly long, and used in exactly one location. Just spell it out at the site. NFC. llvm-svn: 293450
* experimental: tolerate the existence of a `__deref` macroSaleem Abdulrasool2017-01-301-2/+2
| | | | | | | | Microsoft's SAL has a `__deref` macro which results in a compilation failure when building the filesystem module on Windows. Rename the member function internally to avoid the conflict. llvm-svn: 293449
* experimental: remove dead functionSaleem Abdulrasool2017-01-291-13/+0
| | | | | | | This template was defined inline, within the TU only and had no uses across the entire repository. Remove the dead code. NFC. llvm-svn: 293445
* Revert "[libcxx] Never use <cassert> within libc++"Eric Fiselier2017-01-244-5/+11
| | | | | | | | This reverts commit r292883. Unfortunately <string_view> uses _LIBCPP_ASSERT in a way which is not compatible with the C++11 dylib build. I'll investigate more tomorrow. llvm-svn: 292923
* [libcxx] Never use <cassert> within libc++Eric Fiselier2017-01-244-11/+5
| | | | | | | | | | | | | | | | | Summary: It is my opinion that libc++ should never use `<cassert>`, including in the `dylib`. This patch remove all uses of `assert` from within libc++ and replaces most of them with `_LIBCPP_ASSERT` instead. Additionally this patch turn `LIBCXX_ENABLE_ASSERTIONS` off by default, because the standard library should not be aborting user programs unless explicitly asked to. Reviewers: mclow.lists, compnerd, smeenai Reviewed By: mclow.lists Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D29063 llvm-svn: 292883
* Disable aligned new/delete on Apple platforms without posix_memalignEric Fiselier2017-01-201-0/+4
| | | | | | | | | | | | | | | | | | | Summary: This patch disables the aligned new/delet overloads on Apple platforms without `posix_memalign`. This fixes libc++.dylib build regressions on such platforms. This fixes http://llvm.org/PR31448. This patch should also be merged into the 4.0 release branch Reviewers: mclow.lists, rsmith, dexonsmith, jeremyhu Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28931 llvm-svn: 292564
* [NFC] Group aligned new/delete definitions together in new.cppEric Fiselier2017-01-201-85/+85
| | | | | | This patch is cleanup to prepare for future changes llvm-svn: 292560
* Add ABI option to remove recently inlined __shared_count functions from the ↵Eric Fiselier2017-01-172-1/+4
| | | | | | | | | | | | | | library. In order to allow inlining of previously out-of-line functions without an ABI break libc++ provides legacy definitions in the dylib that old programs can continue to use. Unfortunatly Windows link.exe detects this hack and diagnoses the duplicate definitions. This patch disable the duplicate definitions on Windows by adding an ABI option which disables all "legacy out-of-line symbols" llvm-svn: 292190
* [Test patch] Inline hot functions in libcxx shared_ptrKevin Hu2017-01-171-30/+8
| | | | | | | | | | | Moves hot functions such as atomic add into the memory header file so that they can be inlined, which brings performance benefits. Patch by Kevin Hu, Aditya Kumar, Sebastian Pop Differential Revision: https://reviews.llvm.org/D24991 llvm-svn: 292184
* Improve CMake and LIT support for WindowsEric Fiselier2017-01-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains multiple cleanups and fixes to better support building on Windows. * [Test] Fix handling of library runtime search paths by correctly adding them to the PATH variable when running the tests. * [Test] Don't explicitly force "--target=i686-pc-windows" when running the test suite. Clang++ seems to deduce the correct target. * [Test] Fix `.sh.cpp` tests on Windows by properly escaping flags used in shell commands. Specifically windows style paths which included spaces were causing these tests to fail. * [CMake] Add "vcruntime" to the list of supported C++ ABI libraries in CMake, and teach the test suite how to handle it. For now libc++ defaults to using "vcruntime" on Windows except when libc++abi is in tree; That is probably a bug and should be changed to always use vcruntime, at least for now. * [Misc] Move the "c++-build" include directory to the libc++ binary dir instead of the top level project dir and rename it "c++build". This is just misc cleanup. Libc++ shouldn't be creating internal build files and directories at the top-level projects root. * [Misc] Build type_info's destructor when building for MSVC. This is a temporary work around to prevent link errors until we have a proper type_info implementation. llvm-svn: 292157
* [libcxx] Follow-up to r292107Asiri Rathnayake2017-01-161-5/+5
| | | | | | I've missed a couple of updates. NFC. llvm-svn: 292109
* Fix Windows try_lock implementationEric Fiselier2017-01-141-2/+2
| | | | llvm-svn: 292011
* [libc++] Pair _aligned_malloc with _aligned_freeShoaib Meenai2017-01-121-0/+4
| | | | | | | | | | | | | | | | | | Attempting to pair an `_aligned_malloc` with a regular free causes heap corruption. Pairing with `_aligned_free` is required instead. Makes the following libc++ tests pass on Windows: ``` std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp ``` Differential Revision: https://reviews.llvm.org/D28512 llvm-svn: 291743
* [Chrono][Darwin] Include header for gettimeofdayBruno Cardoso Lopes2017-01-101-1/+1
| | | | | | | Followup on r291466 and include the proper header. This fixes: https://build.chromium.org/p/chromium.fyi/builders/ClangToTMac/builds/12620/steps/gclient%20runhooks/logs/stdio llvm-svn: 291517
* [Chrono][Darwin] Make steady_clock use CLOCK_UPTIME_RAWBruno Cardoso Lopes2017-01-091-3/+45
| | | | | | | | | | | | | | Use CLOCK_UPTIME_RAW in case clock_gettime is available on Darwin. On Apple platforms only CLOCK_UPTIME_RAW or mach_absolute_time are able to time functions in the nanosecond range. Thus, they are the only acceptable implementations of steady_clock. Differential Revision: https://reviews.llvm.org/D27429 rdar://problem/29449467 llvm-svn: 291466
* [libc++] Implement terminate(), unexpected() and uncaught_exceptions() on ↵Eric Fiselier2017-01-071-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | Windows Summary: This patch implements the following functions on Windows by forwarding to the MSVCRT: * `get_terminate()` * `set_terminate()` * `terminate()` * `set_unexpected()` * `get_unexpected()` * `unexpected()` * `uncaught_exception()` * `uncaught_exceptions()` Reviewers: compnerd, rnk, majnemer, smeenai Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28442 llvm-svn: 291343
* Ensure Sleep(...) isn't passed the value 0 on WindowsEric Fiselier2017-01-071-1/+1
| | | | llvm-svn: 291342
* Explicitly specify MSVC mangling of iostream globals. Patch from Dave LeeEric Fiselier2017-01-071-10/+42
| | | | llvm-svn: 291337
* system_error: correct ELAST emulation on WindowsSaleem Abdulrasool2017-01-071-1/+1
| | | | | | | | | | ELAST should point to the last valid error string value. However, `_sys_nerr` provides the number of elements in the errlist array. Since the index is 0-based, this is off-by-one. Adjust it accordingly. Thanks to David Majnemer for catching this! llvm-svn: 291336
* [libc++] Tolerate presence of __deallocate macroEric Fiselier2017-01-071-1/+1
| | | | | | | | | | | | | | | Summary: On Windows the identifier `__deallocate` is defined as a macro by one of the Windows system headers. Previously libc++ worked around this by `#undef __deallocate` and generating a warning. However this causes the WIN32 version of `__threading_support` to always generate a warning on Windows. This is not OK. This patch renames all usages of `__deallocate` internally as to not conflict with the macro. Reviewers: mclow.lists, majnemer, rnk, rsmith, smeenai, compnerd Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28426 llvm-svn: 291332
* thread: implement sleep_for on WindowsSaleem Abdulrasool2017-01-071-0/+7
| | | | | | | | | | Windows does not provide an implementation of `nanosleep`. Round up the time duration to the nearest ms and use `Sleep`. Although this may over-sleep, there is no hard real-time guarantee on the wake, so sleeping a bit more is better than under-sleeping as it within the specification. llvm-svn: 291331
* Add _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] macros.Eric Fiselier2017-01-061-1/+1
| | | | | | | | | | | | This patch refactors the compiler detection done in `__config` by creating a set of `_LIBCPP_COMPILER_<TYPE>` macros. The goal of this patch is to make it easier to detect what compiler is being used outside of `__config`. Additionally this patch removes workarounds for GCC in `__bit_reference`. I tested GCC 4.8 and 4.9 without the workaround and neither seemed to need it anymore. llvm-svn: 291286
* config_elast: fix typo (NFC)Saleem Abdulrasool2017-01-051-1/+1
| | | | | | Missed the original typo which was duplicated. NFC. llvm-svn: 291192
* thread_support: split out {,non-}recursive mutexSaleem Abdulrasool2017-01-051-4/+4
| | | | | | | | Split out the recursive and non-recursive mutex. This split is needed for platforms which may use differing types for the two mutex (e.g. Win32 threads). llvm-svn: 291145
* Fix std::pointer_safety type in ABI v2Eric Fiselier2017-01-051-2/+3
| | | | | | | | | | | | | | | | | | | | In the C++ standard `std::pointer_safety` is defined as a C++11 strongly typed enum. However libc++ currently defines it as a class type which simulates a C++11 enumeration. This can be detected in valid C++ code. This patch introduces an the _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE ABI option. When defined `std::pointer_safety` is implemented as an enum type. Unfortunatly this also means it can no longer be provided as an extension in C++03. Additionally this patch moves the definition for `get_pointer_safety()` out of the dylib, and into the headers. New usages of `get_pointer_safety()` will now use the inline version instead of the dylib version. However in order to keep the dylib ABI compatible the old definition is explicitly compiled into it. llvm-svn: 291046
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-3/+3
| | | | | | | | | | | | | The name _LIBCPP_TYPE_VIS_ONLY is no longer accurate because both _LIBCPP_TYPE_VIS and _LIBCPP_TYPE_VIS_ONLY expand to __attribute__((__type_visibility__)) with Clang. The only remaining difference is that _LIBCPP_TYPE_VIS_ONLY can be applied to templates whereas _LIBCPP_TYPE_VIS cannot (due to dllimport/dllexport not being allowed on templates). This patch renames _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS. llvm-svn: 291035
* fix elast configuration on Windows targetsSaleem Abdulrasool2017-01-041-1/+3
| | | | | | | A typo and missing header inclusion was obscured by the litany of user defined literal warnings. This fixes the detection of ELAST on windows. llvm-svn: 290941
* clean up use of _WIN32Saleem Abdulrasool2017-01-036-18/+19
| | | | | | | | | Replace the use of _WIN32 in libc++. Replace most use with a C runtime check _LIBCPP_MSVCRT or the new _LIBCPP_WIN32 to indicate that we are using the Win32 API. Use a new _LIBCPP_WCHAR_IS_UCS2 to indicate that we are on an environment that has a short wchar_t. llvm-svn: 290910
* system_error: provide a thread safe stringification for WindowsSaleem Abdulrasool2017-01-031-2/+10
| | | | | | | Provide a strerror_r replacement for Windows. This is needed to build libc++ for Windows with threading. llvm-svn: 290851
* Recommit r290839 - Fix configuring and building libc++ w/o an ABI library.Eric Fiselier2017-01-034-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch re-commits a previous attempt to support building libc++ w/o an ABI library. That patch was originally reverted because: 1) It forgot to teach the test suite about "default" ABI libraries. 2) Some LLVM builders don't clear the CMake cache between builds. The previous patch caused those builders to fail since their old cache entry for LIBCXX_CXX_ABI="" is no longer valid. The updated patch addresses both issues. It works around (2) by adding a hack to force the builders to update their cache entries. The hack will be removed shortly once all LLVM builders have run. Original commit message ----------------------- Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits of the C++ STL. However we also support building w/o an ABI library entirely. This patch fixes building libc++ w/o an ABI library (and incorporates the `~type_info()` fix in D28211). The main changes in this patch are: 1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default". 2) Fix CMake bits which treated "none" as "default" on OS X. 3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`. 4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined. Unfortunately this patch doesn't help clean up the macro mess that we use to configure for different ABI libraries. llvm-svn: 290849
* Revert r290839 - Fix configuring and building libc++ w/o an ABI libraryEric Fiselier2017-01-024-19/+8
| | | | llvm-svn: 290841
* Introduce _LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR ABI option.Eric Fiselier2017-01-021-0/+2
| | | | | | | | | | | | | Currently libc++ compiles a special version of error_category() into the dylib. This definition is no longer needed, and doesn't work on Windows due to dllimport/dllexport semantics. For those reasons this patch introduces an option to disable/enable this definition. By default the definition is provided in ABI v1 except on windows. This patch also addresses D28210. llvm-svn: 290840
* Fix configuring and building libc++ w/o an ABI library.Eric Fiselier2017-01-024-8/+19
| | | | | | | | | | | | | | | | | | | Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits of the C++ STL. However we also support building w/o an ABI library entirely. This patch fixes building libc++ w/o an ABI library (and incorporates the `~type_info()` fix in D28211). The main changes in this patch are: 1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default". 2) Fix CMake bits which treated "none" as "default" on OS X. 3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`. 4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined. Unfortunately this patch doesn't help clean up the macro mess that we use to configure for different ABI libraries. llvm-svn: 290839
* win32: temporarily disable setting locale on 14+Saleem Abdulrasool2017-01-021-0/+4
| | | | | | | | | | The locale structures have been made opaque in CRT 14+. This currently prevents building libc++ for Windows. We can re-enable this in the future when we have replicated the structure to access the private field for the name (unless there exists a better supported mechanism to query the name of a locale given the locale_t). llvm-svn: 290835
* chrono: correct the units for the epoch biasSaleem Abdulrasool2017-01-021-2/+1
| | | | | | | | As pointed out by Howard, this is actually 134774 days (* 24 * 3600), and therefore seconds, not 100ns units. Adjust the units to reflect reality. llvm-svn: 290824
* locale: update ctype access for MSVC CRT 14+Saleem Abdulrasool2017-01-021-2/+9
| | | | | | | | | | | Visual C++ 14 and newer split msvcrt into msvcrt and ucrt with flavours of the ucrt for different environments. This changed the access to the ctype table by introducing the `__pctype_func` and `__pwctype_func` accessors. Use this rather than directly accessing `_ctype` which allows us to be safer in threaded situations by going through the libc locking. llvm-svn: 290823
* chrono: address post commit comments from HowardSaleem Abdulrasool2017-01-011-13/+17
| | | | | | | | | | | | | | | | | Drawing some inspiration from code from Bill O'Neal as pointed out by Howard, rework the code to avoid an overflow in the duration. Adjust the style to match libc++ style as well. Create a local typedef for the FILETIME duration (100-ns units). Use this to define the difference between the NT and the UNIX epochs (which previously overflowed due to the representation limits due to the bouncing to ns). Return the FILETIME duration biased by the NT-to-UNIX epoch conversion. Use of the custom duration makes it easier to read and reason about the code. llvm-svn: 290806
* chrono: address post-commit comments from majnemerSaleem Abdulrasool2017-01-011-8/+8
| | | | | | | Correct style to match libc++ style as pointed out by David Majnemer on IRC. NFC. llvm-svn: 290805
* chrono: give Windows a steady_clockSaleem Abdulrasool2017-01-011-14/+29
| | | | | | | Provide a definition for a steady monotonic clock by wrapping QueryPerformanceCounter. llvm-svn: 290804
* chrono: implement a Windows version of system_clock::nowSaleem Abdulrasool2017-01-011-0/+32
| | | | | | | | | | | | | | system_clock::now is not entirely straight forward on Windows, which does not have a clock_gettime function. GetSystemTimeAsFileTime gives us the value relative to the NT epoch (Jan 1 1601) rather than the Unix epoch (Jan 1 1970). However, this function has a low resolution (~10ms). Newer versions of Windows provide GetSystemTimePreciseAsFileTime which gives us a much more accurate time (<1us). Unfortunately, the latter is only available on Windows 8+ when targeting desktop apps. llvm-svn: 290803
* system_error: use strerror_r only for threaded codeSaleem Abdulrasool2016-12-311-0/+2
| | | | | | | | When building libc++ without threading, strerror_r is not used. Define the code only when threading is enabled. This allows us to build system_error for Windows, which ATM doesn't build with threading. llvm-svn: 290791
* random: include __config before buildingSaleem Abdulrasool2016-12-311-0/+2
| | | | | | | We need to include __config to ensure that we know what random implementation is being used. Fixes compilation for Windows. llvm-svn: 290775
* Fix debug mode build w/o exceptionsEric Fiselier2016-12-281-0/+4
| | | | llvm-svn: 290652
OpenPOWER on IntegriCloud