summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* [libc++] Don't define operator new/delete when using vcruntimeThomas Anderson2019-01-301-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes build errors on Windows without libc++abi of the form: new(173,36): error: redeclaration of 'operator delete' cannot add 'dllexport' attribute _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT; vcruntime_new.h(87,16): note: previous declaration is here void __CRTDECL operator delete( new(205,70): error: redefinition of 'operator new' _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;} vcruntime_new.h(184,28): note: previous definition is here inline void* __CRTDECL operator new(size_t _Size, _Writable_bytes_(_Size) void* _Where) noexcept new(206,70): error: redefinition of 'operator new[]' _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;} vcruntime_new.h(199,28): note: previous definition is here inline void* __CRTDECL operator new[](size_t _Size, new(207,40): error: redefinition of 'operator delete' inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {} vcruntime_new.h(190,27): note: previous definition is here inline void __CRTDECL operator delete(void*, void*) noexcept new(208,40): error: redefinition of 'operator delete[]' inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {} vcruntime_new.h(206,27): note: previous definition is here inline void __CRTDECL operator delete[](void*, void*) noexcept Differential Revision: https://reviews.llvm.org/D57362 llvm-svn: 352647
* [libc++] Fix Windows build error in <functional>Thomas Anderson2019-01-291-5/+6
| | | | | | | | | | | | On my Windows system, __allocator is defined to nothing. This change fixes build errors of the below form: In file included from algorithm:644: functional(1492,31): error: expected member name or ';' after declaration specifiers const _Alloc& __allocator() const { return __f_.second(); } Differential Revision: https://reviews.llvm.org/D57355 llvm-svn: 352561
* [libc++] Fix Windows build error in include/filesystemThomas Anderson2019-01-291-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | _LIBCPP_FUNC_VIS is redundant since the class is already annotated with _LIBCPP_EXCEPTION_ABI. Fixes this build error: In file included from fstream:188: filesystem(1350,3): error: attribute 'dllimport' cannot be applied to member of 'dllimport' class _LIBCPP_FUNC_VIS __config(674,37): note: expanded from macro '_LIBCPP_FUNC_VIS' #define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS __config(666,38): note: expanded from macro '_LIBCPP_DLL_VIS' # define _LIBCPP_DLL_VIS __declspec(dllimport) filesystem(1313,7): note: previous attribute is here class _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error { __config(675,37): note: expanded from macro '_LIBCPP_EXCEPTION_ABI' #define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS __config(666,38): note: expanded from macro '_LIBCPP_DLL_VIS' # define _LIBCPP_DLL_VIS __declspec(dllimport) Differential Revision: https://reviews.llvm.org/D57354 llvm-svn: 352525
* Fix PR40495 - is_invokable_v<void> does not compileEric Fiselier2019-01-291-17/+20
| | | | | | | | | | | The meta-programming that attempted to form the invoke call expression was not in a SFINAE context. This made it a hard error to provide non-referencable types like 'void' or 'void (...) const'. This patch fixes the error by checking the validity of the call expression within a SFINAE context. llvm-svn: 352522
* D14686: 'Protect against overloaded comma in random_shuffle and improve ↵Marshall Clow2019-01-241-2/+2
| | | | | | tests' I had to cut back on the tests with this, because they were not C++03 friendly. Thanks to gribozavr for the patch llvm-svn: 352087
* Change a couple of '&' to addressof(). NFCMarshall Clow2019-01-241-3/+3
| | | | llvm-svn: 352007
* Apply D28248: 'Work around GCC PR37804'. Thanks to mdaniels for the patchMarshall Clow2019-01-231-0/+7
| | | | llvm-svn: 351993
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-19162-648/+486
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1915-60/+45
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Bump the trunk version to 9.0.0svnHans Wennborg2019-01-162-2/+2
| | | | llvm-svn: 351320
* Fix feature test macros for atomics/mutexes without threadingEric Fiselier2019-01-161-4/+12
| | | | llvm-svn: 351291
* Fix PR40230 - std::pair may have padding on FreeBSD.Eric Fiselier2019-01-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: FreeBSD ships a very old and deprecated ABI for std::pair where the copy and move constructors are not allowed to be trivial. D25389 change how this was implemented by introducing a non-trivial base class. This patch, introduced in October 2016, introduced an ABI bug that caused nested `std::pair` instantiations to have padding. For example: ``` using PairT = std::pair< std::pair<char, char>, char >; static_assert(offsetof(PairT, first) == 0, "First member should exist at offset zero"); // Fails on FreeBSD! ``` The bug occurs because the base class for the first element (the nested pair) cannot be put at offset zero because the top-level pair already has the same base class laid out there. This patch fixes that ABI bug by templating the dummy base class on the same parameters as the pair. Technically this fix is an ABI break for users who depend on the "broken" ABI introduced in 2016. I'm putting this up for review so that the FreeBSD maintainers can sign off on fixing the ABI by breaking the ABI. Another option, since we have to "break" the ABI to fix it, would be to move FreeBSD off the deprecated non-trivial pair ABI instead. Also see: * https://llvm.org/PR40230 * https://reviews.llvm.org/D21329 Reviewers: rsmith, dim, emaste Reviewed By: rsmith Subscribers: mclow.lists, krytarowski, christof, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D56357 llvm-svn: 351290
* Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. Eric Fiselier2019-01-168-45/+57
| | | | | | | | | | | | | | | | | | | | | Summary: Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See llvm.org/PR39713 This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used. This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement. I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. Reviewers: ldionne, EricWF Reviewed By: ldionne, EricWF Subscribers: jyknight, christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D54814 llvm-svn: 351289
* Implement feature test macros using a script.Eric Fiselier2019-01-161-91/+187
| | | | | | | | | | | | | | | | | | | | Summary: This patch implements all the feature test macros libc++ currently supports, as specified by the standard or cppreference prior to C++2a. The tests and `<version>` header are generated using a script. The script contains a table of each feature test macro, the headers it should be accessible from, and its values of each dialect of C++. When a new feature test macro is added or needed, the table should be updated and the script re-run. Reviewers: mclow.lists, jfb, serge-sans-paille Reviewed By: mclow.lists Subscribers: arphaman, jfb, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D56750 llvm-svn: 351286
* [libcxx] Mark do_open, do_get and do_close parameters unused when catopen is ↵Petr Hosek2019-01-132-0/+8
| | | | | | | | | | | | missing When catopen is missing, do_open, do_get and do_close end up being no-op, and as such their parameters will be unused which triggers a warning/error when building with -Wunused-parameter. Differential Revision: https://reviews.llvm.org/D56023 llvm-svn: 351027
* Change from a to a . Fixes PR#39871.Marshall Clow2019-01-114-15/+15
| | | | llvm-svn: 350972
* [libcxx] Call __count_bool_true for bitset countAdhemerval Zanella2019-01-111-1/+1
| | | | | | | | | | | | | | | | | This patch aims to help clang with better information so it can inline __bit_reference count function usage for both std::biset. Current clang inliner can not infer that the passed typed will be used only to select the optimized variant, it evaluates the type argument and type check as a load plus compare (although later optimization phases correctly optimized this out). It is mainly to help llvm inliner to generate better code for std::bitset count for aarch64. It helps on both runtime and code size, since if inline decides that _VSTD::count should not be inlined the vectorization will create both aligned and unaligned variants (which add both code size and runtime costs) llvm-svn: 350936
* Implement the 'sys_time' portions of the C++20 calendaring stuff. Reviewed ↵Marshall Clow2019-01-111-29/+157
| | | | | | as D56494 llvm-svn: 350929
* [libcxx] Reorganize tests since the application of P0602R4Louis Dionne2019-01-102-6/+6
| | | | | | | | | | | | | | | | | Summary: P0602R4 makes the special member functions of optional and variant conditionally trivial based on the types in the optional/variant. We already implemented that, but the tests were organized as if this were a non-standard extension. This patch reorganizes the tests in a way that makes more sense since this is not an extension anymore. Reviewers: EricWF, mpark, mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D54772 llvm-svn: 350884
* Set the buffer of an fstream to empty when the underlying file is closed. ↵Marshall Clow2019-01-081-0/+1
| | | | | | This 'fixes' PR#38052 - std::fstream still good after closing and updating content. llvm-svn: 350603
* [libcxx] Optimize vectors construction of trivial types from an iterator ↵Volodymyr Sapsai2019-01-081-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | range with const-ness mismatch. We already have a specialization that will use memcpy for construction of trivial types from an iterator range like std::vector<int>(int *, int *); But if we have const-ness mismatch like std::vector<int>(const int *, const int *); we would use a slow path that copies each element individually. This change enables the optimal specialization for const-ness mismatch. Fixes PR37574. Contributions to the patch are made by Arthur O'Dwyer, Louis Dionne. rdar://problem/40485845 Reviewers: mclow.lists, EricWF, ldionne, scanon Reviewed By: ldionne Subscribers: christof, ldionne, howard.hinnant, cfe-commits Differential Revision: https://reviews.llvm.org/D48342 llvm-svn: 350583
* Fix PR39749 - Headers containing just #error harm __has_include.Eric Fiselier2019-01-068-19/+99
| | | | | | | | | | | This patch changes <experimental/foo> to use #warning instead of is harmful to common feature detection idioms. We should also consider only emitting the warning when __DEPRECATED is defined, like we do in the <ext/foo> headers. Users may want to specify "-Werror=-W#warnings" while still ignoring the libc++ warnings. llvm-svn: 350485
* [libcxx] Remove unused macro _LIBCPP_HAS_UNIQUE_TYPEINFOLouis Dionne2018-12-211-6/+2
| | | | | | | | | | | | | | Summary: We already have the negation of that as _LIBCPP_HAS_NONUNIQUE_TYPEINFO. Having both defined is confusing, since only one of them is used. Reviewers: EricWF, mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D54537 llvm-svn: 349947
* [NFC] Fix typo in commentLouis Dionne2018-12-211-1/+1
| | | | llvm-svn: 349932
* Don't forward declare _FilesystemClock in C++03Eric Fiselier2018-12-211-0/+2
| | | | llvm-svn: 349887
* Implement LWG 3065: Make path operators friends.Eric Fiselier2018-12-211-37/+25
| | | | | | | | | This prevents things like: using namespace std::filesystem; auto x = L"a/b" == std::string("a/b"); llvm-svn: 349884
* Implement LWG 3145: file_clock breaks ABI for C++17 implementations.Eric Fiselier2018-12-212-31/+42
| | | | | | | This patch adds std::chrono::file_clock, but without breaking the existing ABI for std::filesystem. llvm-svn: 349883
* [libcxx] Use custom allocator's `construct` in C++03 when available.Volodymyr Sapsai2018-12-191-21/+27
| | | | | | | | | | | | | | | | | Makes libc++ behavior consistent between C++03 and C++11. Can use `decltype` in C++03 because `include/__config` defines a macro when `decltype` is not available. Reviewers: mclow.lists, EricWF, erik.pilkington, ldionne Reviewed By: ldionne Subscribers: dexonsmith, cfe-commits, howard.hinnant, ldionne, christof, jkorous, Quuxplusone Differential Revision: https://reviews.llvm.org/D48753 llvm-svn: 349676
* [libcxx][NFC] Properly indent nested #ifdefs and #definesLouis Dionne2018-12-171-7/+7
| | | | | | | I just realized I had always been reading this wrong because of the lack of indentation, so I'm re-indenting this properly. llvm-svn: 349408
* [libcxx] Speeding up partition_point/lower_bound/upper_boundLouis Dionne2018-12-171-4/+30
| | | | | | | | | | This is a re-application of r345525, which had been reverted by fear of a regression. Reviewed as https://reviews.llvm.org/D53994. Thanks to Denis Yaroshevskiy for the patch. llvm-svn: 349358
* [regex] Use distinct __regex_word on NetBSDMichal Gorny2018-12-161-0/+4
| | | | | | | | | | NetBSD defines character classes up to 0x2000. Use 0x8000 as a safe __regex_word that hopefully will not collide with other values in the foreseeable future. Differential Revision: https://reviews.llvm.org/D55657 llvm-svn: 349293
* When resolving a merge conflict, I put something inside an #ifdef. Fixed.Marshall Clow2018-12-141-1/+1
| | | | llvm-svn: 349181
* Implement P1209 - Adopt Consistent Container Erasure from Library ↵Marshall Clow2018-12-1411-0/+185
| | | | | | Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532 llvm-svn: 349178
* [libc++] Fix _LIBCPP_EXPORTED_FROM_ABI when visibility annotations are disabledThomas Anderson2018-12-131-1/+5
| | | | | | | | | | | | | Fixes a bug where functions would get exported when building with -fvisibility=hidden and defining _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS. No visibility annotations should be added in this case. The new logic for _LIBCPP_EXPORTED_FROM_ABI matches that of the other visibility annotations around it. Differential Revision: https://reviews.llvm.org/D55664 llvm-svn: 349080
* [libcxx] Add assertion in deque::pop_back when popping from an empty dequeLouis Dionne2018-12-121-4/+5
| | | | | | | | Also, add tests making sure that vector and deque both catch the problem when assertions are enabled. Otherwise, deque would segfault and vector would never terminate. llvm-svn: 348994
* [pair] Mark constructors as conditionally noexceptLouis Dionne2018-12-111-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: std::tuple marks its constructors as noexcept when the corresponding memberwise constructors are noexcept too -- this commit improves std::pair so that it behaves the same. This is a re-application of r348824, which broke the build in C++03 mode because a test was marked as supported in C++03 when it shouldn't be. Note: I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)` constructors because those are non-standard extensions, and supporting them properly is tedious (we have to copy the rvalue-referenceness of the deduced _Tuple&& onto the result of tuple_element). <rdar://problem/29537079> Reviewers: mclow.lists, EricWF Subscribers: christof, llvm-commits Differential Revision: https://reviews.llvm.org/D48669 llvm-svn: 348847
* Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308Marshall Clow2018-12-1111-3/+151
| | | | llvm-svn: 348828
* Revert "[pair] Mark constructors as conditionally noexcept"Louis Dionne2018-12-111-21/+1
| | | | | | | This broke the tests on Linux. Reverting until I find out why the tests are broken (tomorrow). llvm-svn: 348825
* [pair] Mark constructors as conditionally noexceptLouis Dionne2018-12-111-1/+21
| | | | | | | | | | | | | | | | | | | | | | | Summary: std::tuple marks its constructors as noexcept when the corresponding memberwise constructors are noexcept too -- this commit improves std::pair so that it behaves the same. Note: I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)` constructors because those are non-standard extensions, and supporting them properly is tedious (we have to copy the rvalue-referenceness of the deduced _Tuple&& onto the result of tuple_element). <rdar://problem/29537079> Reviewers: mclow.lists, EricWF Subscribers: christof, llvm-commits Differential Revision: https://reviews.llvm.org/D48669 llvm-svn: 348824
* Add a version of std::function that includes a few optimizations in ABI V2.Eric Fiselier2018-12-112-0/+305
| | | | | | | | | | Patch by Jordan Soyke (jsoyke@google.com) Reviewed as D55045 The result of running the benchmarks and comparing them can be found here: https://gist.github.com/EricWF/a77fd42ec87fc98da8039e26d0349498 llvm-svn: 348812
* Refactor std::function to more easily support alternative implementations.Eric Fiselier2018-12-101-200/+310
| | | | | | | | | | | | Patch from Jordan Soyke (jsoyke@google.com) Reviewed as D55520 This change adds a new internal class, called __value_func, that adds a minimal subset of value-type semantics to the internal __func interface. The change is NFC, and is cleanup for the upcoming ABI v2 function implementation (D55045). llvm-svn: 348778
* [libcxx] Add paranoid cast-to-void in comma operatorLouis Dionne2018-12-071-1/+1
| | | | llvm-svn: 348611
* [libc++] Improve diagnostics for non-const comparators and hashers in ↵Louis Dionne2018-12-066-66/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | associative containers Summary: When providing a non-const-callable comparator in a map or set, the warning diagnostic does not include the point of instantiation of the container that triggered the warning, which makes it difficult to track down the problem. This commit improves the diagnostic by placing it directly in the body of the associative container. The same change is applied to unordered associative containers, which had a similar problem. Finally, this commit cleans up the forward declarations of several map and unordered_map helpers, which are not needed anymore. <rdar://problem/41370747> Reviewers: EricWF, mclow.lists Subscribers: christof, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D48955 llvm-svn: 348529
* [libcxx] Don't depend on availability markup to provide the streams in the dylibLouis Dionne2018-12-064-9/+12
| | | | | | | | | | | | Whether an explicit instantiation declaration should be provided is not a matter of availability markup. This problem is exemplified by the fact that some tests were incorrectly marked as XFAIL when they should instead have been using the definition of streams from the headers, and hence passing, and that, regardless of whether visibility annotations are enabled. llvm-svn: 348436
* [libcxx] Implement P0318: unwrap_ref_decay and unwrap_referenceLouis Dionne2018-12-033-35/+35
| | | | | | | | | | | | | | | | | | Summary: This was voted into C++20 in San Diego. Note that there was a revision D0318R2 which did include unwrap_reference_t, but we mistakingly voted P0318R1 into the C++20 Working Draft (which does not include unwrap_reference_t). This patch implements D0318R2, which is what we'll end up with in the Working Draft once this mistake has been fixed. Reviewers: EricWF, mclow.lists Subscribers: christof, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D54485 llvm-svn: 348138
* First part of P0482 - Establish that char8_t is an integral type, and that ↵Marshall Clow2018-11-292-0/+4
| | | | | | numeric_limits<char8_t> is valid and sane. (second try) llvm-svn: 347930
* Revert commit r347904 because it broke older compilersMarshall Clow2018-11-292-4/+0
| | | | llvm-svn: 347908
* First part of P0482 - Establish that char8_t is an integral type, and that ↵Marshall Clow2018-11-292-0/+4
| | | | | | numeric_limits<char8_t> is valid and sane. llvm-svn: 347904
* [libcxx] Remove bad_array_lengthLouis Dionne2018-11-292-37/+0
| | | | | | | | | | | | | | | | Summary: std::bad_array_length was added by n3467, but this never made it into C++. This commit removes the definition of std::bad_array_length from the headers AND from the shared library. See the comments in the ABI changelog for details about the ABI implications of this change. Reviewers: mclow.lists, dexonsmith, howard.hinnant, EricWF Subscribers: christof, jkorous, libcxx-commits Differential Revision: https://reviews.llvm.org/D54804 llvm-svn: 347903
* Revert "Move internal usages of `alignof`/`__alignof` to use ↵Eric Fiselier2018-11-286-45/+35
| | | | | | | | | | | `_LIBCPP_ALIGNOF`. " This reverts commit 087f065cb0c7463f521a62599884493aaee2ea12. The tests were failing on 32 bit builds, and I don't have time to clean them up right now. I'll recommit tomorrow with fixed tests. llvm-svn: 347816
OpenPOWER on IntegriCloud