summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix breakage introduced by adding -Wshadow.Eric Fiselier2016-10-231-27/+27
| | | | llvm-svn: 284946
* [libcxx] Support std::regex_constants::match_not_nullTim Shen2016-10-211-0/+18
| | | | | | | | | | | | Summary: Fixes PR21597. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25595 llvm-svn: 284881
* [ModuleMap] Add more module entries to cover some non modular headersBruno Cardoso Lopes2016-10-211-0/+342
| | | | | | | | | | These modules are necessary on Darwin to allow modules with 'no_undeclared_includes' (introduced in clang r284797) to work properly while using libc++ headers. Patch extracted from a suggested module.modulemap from Richard Smith! llvm-svn: 284801
* Implement constexpr support for reverse_iterator. Reviewed as ↵Marshall Clow2016-10-191-59/+74
| | | | | | https://reviews.llvm.org/D25534 llvm-svn: 284602
* Make any_cast<void()>(nullptr) compileEric Fiselier2016-10-161-4/+16
| | | | llvm-svn: 284333
* Fix use of non-constexpr C++14 addressofEric Fiselier2016-10-161-1/+1
| | | | llvm-svn: 284325
* Update status for std::optional LWG issues and fix an optional SFINAE bugEric Fiselier2016-10-162-6/+12
| | | | llvm-svn: 284323
* Update issue status for LWG 2744Eric Fiselier2016-10-162-9/+16
| | | | llvm-svn: 284322
* Update issue status for LWG 2768 and 2769Eric Fiselier2016-10-161-3/+6
| | | | llvm-svn: 284321
* Implement modified LWG 2665Eric Fiselier2016-10-151-2/+11
| | | | llvm-svn: 284313
* Implement LWG2664 and update its statusEric Fiselier2016-10-151-0/+2
| | | | llvm-svn: 284310
* [libcxx] Improve the gcc workaround for the missing __has_include macro.Asiri Rathnayake2016-10-141-13/+11
| | | | | | NFC. llvm-svn: 284237
* [libcxx] Do not declare the thread api when __external_threading is presentAsiri Rathnayake2016-10-141-4/+5
| | | | | | | | | | | | | | | | This fixes a small omission where even when __external_threading is provided, we attempt to declare a pthread based threading API. Instead, we should leave out everything for the __external_threading header to take care of. The __threading_support header provides a proof-of-concept externally threaded libc++ variant when _LIBCPP_HAS_THREAD_API_EXTERNAL is defined. But if the __external_threading header is present, we should exclude all of that POC stuff. Reviewers: EricWF Differential revision: https://reviews.llvm.org/D25468 llvm-svn: 284232
* Add void_t and invoke feature test macrosEric Fiselier2016-10-142-0/+4
| | | | llvm-svn: 284209
* Implement P0035R4 -- Add C++17 aligned allocation functionsEric Fiselier2016-10-141-14/+65
| | | | | | | | | | | | | | | | Summary: This patch implements the library side of P0035R4. The implementation is thanks to @rsmith. In addition to the C++17 implementation, the library implementation can be explicitly turned on using `-faligned-allocation` in all dialects. Reviewers: mclow.lists, rsmith Subscribers: rsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D25591 llvm-svn: 284206
* Remove two ABI symbols added after the 3.9 releaseEric Fiselier2016-10-141-0/+1
| | | | llvm-svn: 284200
* Implement http://wg21.link/p0302r1: Removing Allocator Support in ↵Marshall Clow2016-10-131-5/+13
| | | | | | std::function. These functions never worked, and as far as I know, no one ever called them. llvm-svn: 284164
* Revert r282345 - Use __attribute__((internal_linkage)) when available.Eric Fiselier2016-10-131-12/+2
| | | | llvm-svn: 284101
* Mark ostream_iterator's constructors as noexcept.Marshall Clow2016-10-121-2/+2
| | | | llvm-svn: 284021
* [libc++] Correct explanation of _LIBCPP_NEW_DELETE_VISShoaib Meenai2016-10-121-1/+1
| | | | | | | | | | The behavior of this macro actually needs to apply universally on Windows and not just when using the Microsoft CRT. Update the macro definition and documentation accordingly. Differential Revision: https://reviews.llvm.org/D25145 llvm-svn: 284016
* Implement N4606 optionalEric Fiselier2016-10-123-2/+1319
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adapt implementation of Library Fundamentals TS optional into an implementation of N4606 optional. - Update relational operators per http://wg21.link/P0307 - Update to requirements of http://wg21.link/P0032 - Extension: Implement trivial copy/move construction/assignment for `optional<T>` when `T` is trivially copyable. Audit P/Rs for optional LWG issues: - 2756 "C++ WP optional<T> should 'forward' T's implicit conversions" Implemented, which also resolves 2753 "Optional's constructors and assignments need constraints" (modulo my refusal to explicitly delete the move operations, which is a design error that I'm working on correcting in the 2756 P/R). - 2736 "nullopt_t insufficiently constrained" Already conforming. I've added a test ensuring that `nullopt_t` is not copy-initializable from an empty braced-init-list, which I believe is the root intent of the issue, to avoid regression. - 2740 "constexpr optional<T>::operator->" Already conforming. - 2746 "Inconsistency between requirements for emplace between optional and variant" No P/R, but note that the author's '"suggested resolution" is already implemented. - 2748 "swappable traits for optionals" Already conforming. - 2753 "Optional's constructors and assignments need constraints" Implemented. Most of the work for this patch was done by Casey Carter @ Microsoft. Thank you Casey! Reviewers: mclow.lists, CaseyCarter, EricWF Differential Revision: https://reviews.llvm.org/D22741 llvm-svn: 283980
* Revert Add <optional>. Will recommit with better commit messageEric Fiselier2016-10-123-1324/+2
| | | | llvm-svn: 283978
* Add <optional> header.Eric Fiselier2016-10-123-2/+1324
| | | | | | | | This patch is largely thanks to Casey Carter @ Microsoft. He did the initial work of porting our experimental implementation and tests over to namespace std. llvm-svn: 283977
* Remove extraneous 'const' in the implementation of is_move_assignable. ↵Marshall Clow2016-10-111-1/+1
| | | | | | Howard pleads temporary insanity about this. Discussed at http://stackoverflow.com/questions/39986185 llvm-svn: 283945
* Fix std::pair on FreeBSDEric Fiselier2016-10-111-20/+12
| | | | | | | | | | | | | | | | Summary: FreeBSD ships an old ABI for std::pair which requires that it have non-trivial copy/move constructors. Currently the non-trivial copy/move is achieved by providing explicit definitions of the constructors. This is problematic because it means the constructors don't SFINAE properly. In order to SFINAE copy/move constructors they have to be explicitly defaulted and hense non-trivial. This patch attempts to provide SFINAE'ing copy/move constructors for std::pair while still making them non-trivial. It does this by adding a base class with a non-trivial copy constructor and then allowing pair's constructors to be generated by the compiler. This also allows the constructors to be constexpr. Reviewers: emaste, theraven, rsmith, dim Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25389 llvm-svn: 283944
* Fix incorrect exception handling behavior in the uninitialized algorithmsEric Fiselier2016-10-111-39/+100
| | | | llvm-svn: 283941
* [libcxx] Add support for FuchsiaPetr Hosek2016-10-101-0/+4
| | | | | | | | | Fuchsia is a new operating system which uses musl as the standard C library, libc++ and libc++abi as the C++ standard library. Differential Revision: https://reviews.llvm.org/D25414 llvm-svn: 283788
* [libcxx] Fix gcc build.Asiri Rathnayake2016-10-101-0/+16
| | | | | | Attempt to fix a horrible gcc include order problem. llvm-svn: 283762
* Add whitespace to make not_fn_impl more clear. NFC.Marshall Clow2016-10-101-8/+8
| | | | llvm-svn: 283757
* [libcxx] Add the missing limits.h headerAsiri Rathnayake2016-10-101-0/+49
| | | | | | | | | | | | | | | | | The implementation of [depr.c.headers] in D12747 introduced the necessary C headers into libc++. This patch adds one more missing headers: limits.h We spotted this due to a failing C++03 test [limits_h.pass.cpp] in our libc++ configuration; when the limits.h header is included from a C++ program, it now bypassed the __config header and went directly into the underlying C library's limits.h header, which is problematic for us because we use __config header to configure the underlying C library's behaviour when used from a C++ context. Reviewers: mclow.lists, rsmith Differential revision: https://reviews.llvm.org/D25361 llvm-svn: 283726
* Provide a constexpr addressof with GCC 7.Eric Fiselier2016-10-101-1/+1
| | | | | | | | | | | | | | | | __builtin_addressof was added to the GCC trunk in the past week. This patch teaches libc++ about it so it can correctly provide constexpr addressof. Unfortunately this patch will break users of earlier GCC 7 builds, since we expect __builtin_addressof but one won't be provided. One option would be to only use __builtin_addressof for GCC 7.1 and above, but that means waiting for another release. Instead I've specifically chosen to break older GCC 7 versions. Since GCC 7 has yet to be released, and the 7.0 release is a development release, I believe that anybody currently using GCC 7.0 will have no issue upgrading. llvm-svn: 283715
* Disable alignment support of 0x4000 for Win32. https://reviews.llvm.org/D25053Marshall Clow2016-10-071-3/+3
| | | | llvm-svn: 283621
* Fix PR30642 - libc++ leaks always-visible symbols into programsEric Fiselier2016-10-071-1/+1
| | | | | | | | | | | | | | | This was caused by r281673, specifically changing `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` from `__attribute__((__type_visibility__("default")))` to `__attribute__((__visibility("default")))`. I made that change because I thought the external instantiations needed their members to have default visibility. However since libc++ never builds with -fvisibility=hidden this appears not to be needed. Instead this change caused previously hidden inline methods to become un-hidden, which is a regression. This patch reverts the problematic change and fixes PR30642. llvm-svn: 283620
* Fix various issues in std::any and the related tests.Eric Fiselier2016-10-072-62/+51
| | | | | | | | | | | | | | | | | | | | * Fix self-swap. Patch from Casey Carter. * Remove workarounds and tests for types with deleted move constructors. This was originally added as part of a LWG proposed resolution that has since changed. * Re-apply most recent PR for LWG 2769. * Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to use the decayed type. * Fix tests to allow moved-from std::any's to have a non-empty state. This is the behavior of MSVC's std::any. * Various whitespace and test fixes. llvm-svn: 283606
* Fix strict-aliasing violation in typeinfo::hash_code()Eric Fiselier2016-10-052-9/+1
| | | | | | | | | | | | | | | | Summary: The current implementation of `hash_code()` for uniqued RTTI strings violates strict aliasing by dereferencing a type-punned pointer. Specifically it generates a `const char**` pointer from the address of the `__name` member before casting it to `const size_t*` and dereferencing it to get the hash. This is really just a complex and incorrect way of writing `reinterpret_cast<size_t>(__name)`. This patch changes the conversion sequence so that it no longer contains UB. Reviewers: howard.hinnant, mclow.lists Subscribers: rjmccall, cfe-commits Differential Revision: https://reviews.llvm.org/D24012 llvm-svn: 283408
* Change a couple of 'template <typename's to 'template <class' which is what ↵Marshall Clow2016-10-031-3/+3
| | | | | | we use in the rest of the library. llvm-svn: 283162
* Remove some additional unnecessary std:: in cmathHal Finkel2016-10-011-9/+9
| | | | | | | Unlike in math.h, as Eric pointed out in the review of D18639, we don't need the std:: in cmath. llvm-svn: 283052
* Use __builtin_isnan/isinf/isfinite in complexHal Finkel2016-10-012-80/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The libc-provided isnan/isinf/isfinite macro implementations are specifically designed to function correctly, even in the presence of -ffast-math (or, more specifically, -ffinite-math-only). As such, on most implementation, these either always turn into external function calls (e.g. glibc) or are specifically function calls when FINITE_MATH_ONLY is defined (e.g. Darwin). Our implementation of complex arithmetic makes heavy use of isnan/isinf/isfinite to deal with corner cases involving non-finite quantities. This was problematic in two respects: 1. On systems where these are always function calls (e.g. Linux/glibc), there was a performance penalty 2. When compiling with -ffast-math, there was a significant performance penalty (in fact, on Darwin and systems with similar implementations, the code may in fact be slower than not using -ffast-math, because the inline definitions provided by libc become unavailable to prevent the checks from being optimized out). Eliding these inf/nan checks in -ffast-math mode is consistent with what happens with libstdc++, and in my experience, what users expect. This is critical to getting high-performance code when using complex<T>. This change replaces uses of those functions on basic floating-point types with calls to __builtin_isnan/isinf/isfinite, which Clang will always expand inline. When using -ffast-math (or -ffinite-math-only), the optimizer will remove the checks as expected. Differential Revision: https://reviews.llvm.org/D18639 llvm-svn: 283051
* [libc++] Add missing locale aliasesShoaib Meenai2016-09-291-2/+3
| | | | | | | | | Add underscore aliases for strtof_l and strtod_l. _strtold_l exists in VS 2013 and above, so fix that definition as a drive-by fix. Differential Revision: https://reviews.llvm.org/D25059 llvm-svn: 282681
* [libc++] Clarify _LIBCPP_NEW_DELETE_VIS for WindowsShoaib Meenai2016-09-281-2/+2
| | | | | | | | | | | | | | | | | | Replace a stale reference to cxx_EXPORTS with _LIBCPP_BUILDING_LIBRARY, and clarify why the operator new and delete family of functions are marked dllexport when building but *not* dllimport when including the header externally. The new code is identical to the intent of the old code (and would be functionally equivalent were cxx_EXPORTS still defined when building libc++). The overall behavior is not ideal, since Microsoft's operator new and delete functions will get called instead of libc++'s, but I think consistently calling msvcrt's functions is better than either calling msvcrt's or libc++'s functions depending on header inclusion. Differential Revision: https://reviews.llvm.org/D25042 llvm-svn: 282644
* Expect DLL builds on Windows by default and require a custom __config for staticEric Fiselier2016-09-262-7/+8
| | | | | | | | | | | | | | | | | | | builds. On Windows the __declspec(dllimport) and __declspec(dllexport) attributes require linking to a DLL, not a static library. Previously these annotations were disabled by default unless _LIBCPP_DLL was defined. However the DLL configuration is probably the more common one, so it should be supported by default. This patch enables import/export attributes by default and adds a _LIBCPP_DISABLE_DLL_IMPORT_EXPORT macro which can be used to disable this behavior. If libc++ is built as a static library on Windows then a custom __config header will be generated that predefines this macro. This patch is based off work by Shoaib Meenai. llvm-svn: 282449
* [libc++] Fix typos causing compilation errors when _LIBCPP_DEBUG_LEVEL >= 2Oleg Ranevskyy2016-09-261-2/+2
| | | | | | | | | | | | Summary: This patch fixes a couple of typos that cause compilation errors when application includes <unordered_map> and enables the libc++'s debugging capabilities. Reviewers: EricWF Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D24883 llvm-svn: 282446
* [libc++] Extension: Make `move` and `forward` constexpr in C++11.Eric Fiselier2016-09-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: `std::move` and `std::forward` were not marked constexpr in C++11. This can be very damaging because it makes otherwise constant expressions non-constant. For example: ``` #include <utility> template <class T> struct Foo { constexpr Foo(T&& tx) : t(std::move(tx)) {} T t; }; [[clang::require_constant_initialization]] Foo<int> f(42); // Foo should be constant initialized but C++11 move is not constexpr. As a result `f` is an unsafe global. ``` This patch applies `constexpr` to `move` and `forward` as an extension in C++11. Normally the library is not allowed to add `constexpr` because it may be observable to the user. In particular adding constexpr may cause valid code to stop compiling. However these problems only happen in more complex situations, like making `__invoke(...)` constexpr. `forward` and `move` are simply enough that applying `constexpr` is safe. Note that libstdc++ has offered this extension since at least 4.8.1. Most of the changes in this patch are simply test cleanups or additions. The main changes in the tests are: * Fold all `forward_N.fail.cpp` tests into a single `forward.fail.cpp` test using -verify. * Delete most `move_only_N.fail.cpp` tests because they weren't actually testing anything. * Fold `move_copy.pass.cpp` and `move_only.pass.cpp` into a single `move.pass.cpp` test. * Add return type and noexcept tests for `forward` and `move`. Reviewers: rsmith, mclow.lists, EricWF Subscribers: K-ballo, loladiro Differential Revision: https://reviews.llvm.org/D24637 llvm-svn: 282439
* [include] Declare __STDC_*_MACROS for C++11 compat in old libcMichal Gorny2016-09-262-0/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | Declare __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS before including real inttypes.h/stdint.h when the wrapper-header is included in C++11, in order to enable the necessary macros in C99-compliant libc. The C99 standard defined that the format macros in inttypes.h should be defined by the C++ implementations only when __STDC_FORMAT_MACROS is defined, and the limit and constant macros in stdint.h should be defined only when __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined appropriately. Following this specification, multiple old versions of glibc up to 2.17 do not define those macros by default for C++, rendering the libc++ headers non-compliant to the C++11 standard. In order to achieve the necessary compliance, __STDC_FORMAT_MACROS is defined in wrapped inttypes.h just before including the system inttypes.h, when C++11 or newer is used. Both __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined in newly-wrapped stdint.h. This fixes the C++11 compliance while preserving the current behavior for C++03. Differential Revision: https://reviews.llvm.org/D24903 llvm-svn: 282435
* Fix missing _LIBCPP_INLINE_VISIBILITY macro on C++03 specific __hash_table ↵Eric Fiselier2016-09-251-2/+1
| | | | | | function llvm-svn: 282349
* [libc++] Remove various C++03 feature test macrosEric Fiselier2016-09-256-89/+52
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`. This patch removes the __config macros: * _LIBCPP_HAS_NO_TRAILING_RETURN * _LIBCPP_HAS_NO_TEMPLATE_ALIASES * _LIBCPP_HAS_NO_ADVANCED_SFINAE * _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS * _LIBCPP_HAS_NO_STATIC_ASSERT As a drive I also changed our C++03 static_assert to use _Static_assert if available. I plan to commit this without review if nobody voices an objection. Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24895 llvm-svn: 282347
* Use __attribute__((internal_linkage)) when available.Eric Fiselier2016-09-251-2/+12
| | | | | | | | | | | | | | | | | | | | | Summary: This patch has been a long time coming (Thanks @eugenis). It changes `_LIBCPP_INLINE_VISIBILITY` to use `__attribute__((internal_linkage))` instead of `__attribute__((visibility("hidden"), always_inline))`. The point of `_LIBCPP_INLINE_VISIBILITY` is to prevent inline functions from being exported from both the libc++ library and from user libraries. This helps libc++ better manage it's ABI. Previously this was done by forcing inlining and modifying the symbols visibility. However inlining isn't guaranteed and symbol visibility only affects shared libraries making this an imperfect solution. `internal_linkage` improves this situation by making all symbols local to the TU they are emitted in, regardless of inlining or visibility. IIRC the effect of applying `__attribute__((internal_linkage))` to an inline function is the same as applying `static`. For more information about the attribute see: http://lists.llvm.org/pipermail/cfe-dev/2015-October/045580.html Most of the work for this patch was done by @eugenis. Reviewers: mclow.lists, eugenis Subscribers: eugenis, cfe-commits Differential Revision: https://reviews.llvm.org/D24642 llvm-svn: 282345
* Implement proposed resolution for LWG#2758. Reviewed as D24446. Normally, I ↵Marshall Clow2016-09-241-31/+92
| | | | | | would wait for these to be voted upon at a committee meeting (November), but the current draft standard is broken, and this should fix it. (And if it doesn't, we want to know about it soonest) llvm-svn: 282342
* Implement is_error_code_v and is_error_condition_v for c++17. Rework the ↵Marshall Clow2016-09-241-0/+16
| | | | | | tests for is_error_code and is_error_condition, since they were really lacking. Thanks to Alisdair for the heads-up that we were missing these. llvm-svn: 282331
* [libc++] Remove math_win32.hShoaib Meenai2016-09-242-121/+0
| | | | | | | | | Visual Studio 2013 and onward have all the required functions in their CRT headers, and we don't support older versions anymore. Differential Revision: https://reviews.llvm.org/D24879 llvm-svn: 282328
OpenPOWER on IntegriCloud