summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix PR35564 - std::list splice/erase incorrectly throw in debug mode.Eric Fiselier2018-01-251-4/+4
| | | | | | | | | | | | There was a bug in the implementation of splice where the container sizes were updated before decrementing one of the iterators. Afterwards, the result of decrementing the iterator was flagged as UB by the debug implementation because the container was reported to be empty. This patch fixes that bug by delaying the updating of the container sizes until after the iterators have been correctly constructed. llvm-svn: 323390
* Fix missing return in __tuple_leaf::__can_bind_reference when ↵Eric Fiselier2018-01-241-0/+2
| | | | | | __reference_binds_to_temporary added in r323380. llvm-svn: 323389
* Implement LWG2783: stack::emplace() and queue::emplace() should return ↵Marshall Clow2018-01-242-2/+2
| | | | | | decltype(auto) llvm-svn: 323385
* [libc++] Fix PR20855 -- libc++ incorrectly diagnoses illegal reference ↵Eric Fiselier2018-01-241-14/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | binding in std::tuple. Summary: See https://bugs.llvm.org/show_bug.cgi?id=20855 Libc++ goes out of it's way to diagnose `std::tuple` constructions which are UB due to lifetime bugs caused by reference creation. For example: ``` // The 'const std::string&' is created *inside* the tuple constructor, and its lifetime is over before the end of the constructor call. std::tuple<int, const std::string&> t(std::make_tuple(42, "abc")); ``` However, we are over-aggressive and we incorrectly diagnose cases such as: ``` void foo(std::tuple<int const&, int const&> const&); foo(std::make_tuple(42, 42)); ``` This patch fixes the incorrectly diagnosed cases, as well as converting the diagnostic to use the newly added Clang trait `__reference_binds_to_temporary`. The new trait allows us to diagnose cases we previously couldn't such as: ``` std::tuple<int, const std::string&> t(42, "abc"); ``` Reviewers: rsmith, mclow.lists Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41977 llvm-svn: 323380
* [libcxx] Correctly handle invalid regex character class namesMikhail Maltsev2018-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: Currently when a regular expression contains an invalid character class name std::regex constructors throw an std::regex_error with std::regex_constants::error_brack code. This patch changes the code to std::regex_constants::error_ctype and adds a test. Reviewers: EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42291 llvm-svn: 323322
* libcxx: Allow auto-linking to be disabled with a macro.Peter Collingbourne2018-01-241-5/+7
| | | | | | | | | | | Some users may have a custom build system which gives a different name to the libc++ archive (or does not create an archive at all, instead passing the object files directly to the linker). Give those users a way to disable auto-linking. Differential Revision: https://reviews.llvm.org/D42436 llvm-svn: 323300
* Implement P0463R1: 'Endian just Endian'. Reviewed as ↵Marshall Clow2018-01-241-0/+15
| | | | | | https://reviews.llvm.org/D35472 llvm-svn: 323296
* libcxx: Rename vasprintf function to __libcpp_vasprintf.Peter Collingbourne2018-01-231-7/+0
| | | | | | | | | | | 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: Provide overloads for basic_filebuf::open() et al that take wchar_t* ↵Peter Collingbourne2018-01-232-0/+178
| | | | | | | | | | | | filenames on Windows. This is an MSVC standard library extension. It seems like a reasonable enough extension to me because wchar_t* is the native format for filenames on that platform. Differential Revision: https://reviews.llvm.org/D42225 llvm-svn: 323170
* libcxx: Move Windows threading support into a .cpp file.Peter Collingbourne2018-01-231-266/+32
| | | | | | | | | 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
* Last batch of P0202 constexpr additions: includes/set_intersection/exchangeMarshall Clow2018-01-222-12/+12
| | | | llvm-svn: 323159
* Another batch of P0202 constepr algirithms. ↵Marshall Clow2018-01-221-10/+10
| | | | | | remove/remove_if/remove_copy/remove_copy_if/reverse_copy, and tests (commented out) for rotate_copy, because that depends on std::copy llvm-svn: 323152
* Still more P0202 constexpr-ifying. This batch is: ↵Marshall Clow2018-01-221-11/+12
| | | | | | for_each/for_each_n/lexicographical_compare llvm-svn: 323147
* Change a static_assert to check for is_trivial instead of is_pod, as is ↵Marshall Clow2018-01-222-2/+2
| | | | | | mandated by P0767. llvm-svn: 323071
* More P0202 constexpr work. This commit adds ↵Marshall Clow2018-01-201-34/+18
| | | | | | fill/fill_n/generate/generate_n/unique/unique_copy. I removed a specialization of fill_n that recognized when we were dealing with raw pointers and 1 byte trivially-assignable types and did a memset, because the compiler will do that optimization for us. llvm-svn: 323050
* More P0202 constexpr-ifying in <algorithm>. This commit handles ↵Marshall Clow2018-01-191-10/+10
| | | | | | replace/replace_if/replace_copy/replace_copy_if. llvm-svn: 322975
* More P0202 constexpr-ifying in <algorithm>. This commit handles 'transform'.Marshall Clow2018-01-191-4/+4
| | | | llvm-svn: 322970
* libcxx: Disable CFI in function std::get_temporary_buffer.Peter Collingbourne2018-01-171-0/+1
| | | | | | | | | The specification of this function mandates a cast to uninitialized T*, which is forbidden under CFI. Differential Revision: https://reviews.llvm.org/D42146 llvm-svn: 322744
* libcxx: Stop using private MSVC macros in the exception implementation.Peter Collingbourne2018-01-171-0/+6
| | | | | | | | | | | 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
* More constexpr algorithms from P0202. search/search_nMarshall Clow2018-01-163-22/+22
| | | | llvm-svn: 322566
* Change an internal table of constants for the poisson distribution fromMarshall Clow2018-01-161-1/+1
| | | | | | | | | type 'result_type' to 'double'. The only thing that we ever do with these numbers is to promote them to 'double' and use them in a division. For small result_types, the values were getting truncated, skewing the results. Thanks to James Nagurne for the suggestion. llvm-svn: 322556
* More constexpr algorithms from P0202: lower_bound, upper_bound, equal_range, ↵Marshall Clow2018-01-161-21/+21
| | | | | | binary_search llvm-svn: 322529
* More constexpr (re P0202) - equal and mismatchMarshall Clow2018-01-161-18/+18
| | | | llvm-svn: 322527
* More constexpr from P0202. count and count_if. Also fix a comment that ↵Marshall Clow2018-01-151-6/+6
| | | | | | Morwenn noted. llvm-svn: 322506
* More P0202 constexpr-ifying. All the find_XXX algorithms in this commit.Marshall Clow2018-01-151-18/+18
| | | | llvm-svn: 322504
* partition_point gets the P0202 treatmentMarshall Clow2018-01-151-2/+2
| | | | llvm-svn: 322493
* More constexpr algorithms from P0202. any_of/all_of/none_of.Marshall Clow2018-01-151-6/+6
| | | | llvm-svn: 322492
* First part of P0202: Adding constexpr modifiers to functions in <algorithm> ↵Marshall Clow2018-01-151-51/+46
| | | | | | and <utility>. This commit is all the is_XXX algorithms. llvm-svn: 322489
* [libcxx] Make std::basic_istream::get 0-terminate input array in case of error.Volodymyr Sapsai2018-01-111-1/+4
| | | | | | | | | | | | | | | | | | | It covers the cases when the sentry object returns false and when an exception was thrown. Corresponding standard paragraph is C++14 [istream.unformatted]p9: [...] In any case, if n is greater than zero it then stores a null character into the next successive location of the array. rdar://problem/35566567 Reviewers: EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40677 llvm-svn: 322326
* Implement an _is_allocator type trait for use in deduction guides.Marshall Clow2018-01-111-0/+10
| | | | llvm-svn: 322306
* libcxx: Stop providing a definition of __GLIBC_PREREQ.Peter Collingbourne2018-01-101-5/+7
| | | | | | | | | | | An application may determine whether the C standard library is glibc by testing whether __GLIBC_PREREQ is defined. This breaks if libc++ provides its own definition. Instead, define our own macro in our namespace with the desired semantics. Differential Revision: https://reviews.llvm.org/D41892 llvm-svn: 322201
* Revert "Make rehash(0) work with ubsan's unsigned-integer-overflow."Dan Albert2018-01-081-1/+1
| | | | | | | | | Seems to have broken some tests since I first wrote this a while back. Will reland after checking what went wrong with the tests. This reverts commit 7023194c8d11a081fd01ed25308b3d60193c6a06. llvm-svn: 322039
* Make rehash(0) work with ubsan's unsigned-integer-overflow.Dan Albert2018-01-081-1/+1
| | | | | | | | | | | | Reviewers: mclow.lists, EricWF Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40743 llvm-svn: 322031
* Add the C++17 extensions to std::search. Include the default searcher, but ↵Marshall Clow2018-01-082-82/+122
| | | | | | not the Boyer-Moore or Boyer-Moore-Horspool searcher (yet). BUT put the BM and BMH tests in place, marked to XFAIL. The other searchers will follow soon llvm-svn: 322019
* Mark the transparent version set::count() as const. Thanks to Ivan Matek for ↵Marshall Clow2018-01-071-1/+1
| | | | | | the bug report. llvm-svn: 321966
* Add pre-C++11 is_constructible wrappers for 3 argumentsDimitry Andric2018-01-071-4/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: After rL319736 for D28253 (which fixes PR28929), gcc cannot compile `<memory>` anymore in pre-C+11 modes, complaining: ``` In file included from /usr/include/c++/v1/memory:648:0, from test.cpp:1: /usr/include/c++/v1/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::make_shared(_A0&, _A1&, _A2&)': /usr/include/c++/v1/memory:4365:5: error: wrong number of template arguments (4, should be at least 1) static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" ); ^ In file included from /usr/include/c++/v1/memory:649:0, from test.cpp:1: /usr/include/c++/v1/type_traits:3198:29: note: provided for 'template<class _Tp, class _A0, class _A1> struct std::__1::is_constructible' struct _LIBCPP_TEMPLATE_VIS is_constructible ^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/v1/memory:648:0, from test.cpp:1: /usr/include/c++/v1/memory:4365:5: error: template argument 1 is invalid static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" ); ^ /usr/include/c++/v1/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::allocate_shared(const _Alloc&, _A0&, _A1&, _A2&)': /usr/include/c++/v1/memory:4444:5: error: wrong number of template arguments (4, should be at least 1) static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" ); ^ In file included from /usr/include/c++/v1/memory:649:0, from test.cpp:1: /usr/include/c++/v1/type_traits:3198:29: note: provided for 'template<class _Tp, class _A0, class _A1> struct std::__1::is_constructible' struct _LIBCPP_TEMPLATE_VIS is_constructible ^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/v1/memory:648:0, from test.cpp:1: /usr/include/c++/v1/memory:4444:5: error: template argument 1 is invalid static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" ); ^ ``` This is also reported in https://bugs.freebsd.org/224946 (FreeBSD is apparently one of the very few projects that regularly builds programs against libc++ with gcc). The reason is that the static assertions are invoking `is_constructible` with three arguments, while gcc does not have the built-in `is_constructible` feature, and the pre-C++11 `is_constructible` wrappers in `<type_traits>` only provide up to two arguments. I have added additional wrappers for three arguments, modified the `is_constructible` entry point to take three arguments instead, and added a simple test to is_constructible.pass.cpp. Reviewers: EricWF, mclow.lists Reviewed By: EricWF Subscribers: krytarowski, cfe-commits, emaste Differential Revision: https://reviews.llvm.org/D41805 llvm-svn: 321963
* Correct mistake in pragma usage for WindowsSaleem Abdulrasool2018-01-061-2/+2
| | | | | | | The autolink pragma was missing the pragma name itself. This would result in the pragma being silently dropped. llvm-svn: 321937
* [cmake] Add a config option LIBCXX_HAS_WIN32_THREAD_API for enforcing win32 ↵Martin Storsjo2018-01-051-0/+1
| | | | | | | | | | | | | | | | threads This allows keeping libcxx using win32 threads even if a version of pthread.h is installed. This matches the existing cmake option LIBCXX_HAS_PTHREAD_API. Also add missing documentation about the internal define _LIBCPP_HAS_THREAD_API_WIN32. Differential Revision: https://reviews.llvm.org/D41764 llvm-svn: 321896
* Fix incorrect handling of move-only types in transform_reduce iter iter iter ↵Billy Robert O'Neal III2018-01-051-1/+1
| | | | | | init, and add test. llvm-svn: 321851
* Automated trailing whitespace removal by VS Code.Billy Robert O'Neal III2018-01-051-18/+18
| | | | llvm-svn: 321850
* Update version to 7.0.0svn: cmake, include files and docsHans Wennborg2018-01-032-2/+2
| | | | llvm-svn: 321725
* Implement p0258r2: has_unique_object_representationsMarshall Clow2018-01-032-2/+30
| | | | llvm-svn: 321685
* One more (should be) inline variable that is defined in the dylibMarshall Clow2018-01-021-3/+3
| | | | llvm-svn: 321666
* Un-inline a few more variables that are exported from the dylib.Marshall Clow2018-01-022-11/+11
| | | | llvm-svn: 321664
* Temporarily revert the inlining of 'piecewise_construct' because it is ↵Marshall Clow2018-01-021-1/+1
| | | | | | exported from the dylib. llvm-svn: 321663
* A couple more inlined variables that I missed the first timeMarshall Clow2018-01-021-7/+13
| | | | llvm-svn: 321661
* Implement most of P0607: Inline Variables for the Standard Library. This ↵Marshall Clow2018-01-0214-216/+292
| | | | | | involved marking a lot of variables as inline (but only for C++17 and later). llvm-svn: 321658
* Fix the definitions of 'reference' and 'pointer' in string_view that no one ↵Marshall Clow2017-12-201-2/+2
| | | | | | uses :-). Thanks to K-ballo for the catch. llvm-svn: 321188
* libcxx: Fix for basic_stringbuf::seekoff() after r320604.Peter Collingbourne2017-12-191-2/+3
| | | | | | | | | | | | | As a result of this change, the basic_stringbuf constructor that takes a mode ends up leaving __hm_ set to 0, causing the comparison "__hm_ - __str_.data() < __noff" in seekoff() to succeed, which caused the function to incorrectly return -1. The fix is to account for the possibility of __hm_ being 0 when computing the distance from __hm_ to the start of the string. Differential Revision: https://reviews.llvm.org/D41319 llvm-svn: 321124
* [libcxx] Add WebAssembly supportSam Clegg2017-12-161-0/+2
| | | | | | | | | | | | 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
OpenPOWER on IntegriCloud