summaryrefslogtreecommitdiffstats
path: root/libcxx/include
Commit message (Collapse)AuthorAgeFilesLines
...
* [CMake] Use common variable for all header targets NFCPetr Hosek2018-06-121-3/+3
| | | | | | This simplifies the handling of header targets. llvm-svn: 334477
* Reland "Use custom command and target to install libc++ headers"Petr Hosek2018-06-121-32/+220
| | | | | | | | | | | | | | | | | | | Using file(COPY FILE...) has several downsides. Since the file command is only executed at configuration time, any changes to headers made after the initial CMake execution are ignored. This can lead to subtle errors since the just built Clang will be using stale libc++ headers. Furthermore, since the headers are copied prior to executing the build system, this may hide missing dependencies on libc++ from other LLVM components. This changes replaces the use of file(COPY FILE...) command with a custom command and target which addresses all aforementioned issues and matches the implementation already used by other LLVM components that also install headers like Clang builtin headers. Differential Revision: https://reviews.llvm.org/D44773 llvm-svn: 334468
* Remove unused code from __functional_base. NFC.Eric Fiselier2018-06-062-12/+2
| | | | | | | | | | | | | | Patch from Arthur O'Dwyer. `__user_alloc_construct_impl` is used by <experimental/memory_resource>, but this `__user_alloc_construct` is never used. Also, `<experimental/memory_resource>` doesn't need a full definition of `std::tuple`; just the forward declaration in `<__tuple>` will suffice. Reviewed as https://reviews.llvm.org/D46806 llvm-svn: 334069
* Fix PR37694 - std::vector doesn't correctly move construct allocators.Eric Fiselier2018-06-053-25/+51
| | | | | | | | | | | | | | | | | | | C++2a[container.requirements.general]p8 states that when move constructing a container, the allocator is move constructed. Vector previously copy constructed these allocators. This patch fixes that bug. Additionally it cleans up some unnecessary allocator conversions when copy constructing containers. Libc++ uses __internal_allocator_traits::select_on_copy_construction to select the correct allocator during copy construction, but it unnecessarily converted the resulting allocator to the user specified allocator type and back. After this patch list and forward_list no longer do that. Technically we're supposed to be using allocator_traits<allocator_type>::select_on_copy_construction, but that should seemingly be addressed as a separate patch, if at all. llvm-svn: 334053
* Fix a strict aliasing violation in map and unordered_map.Erik Pilkington2018-06-044-89/+177
| | | | | | | | | | | | These containers type-punned between pair<K, V> and pair<const K, V> as an optimization. This commit instead provides access to the pair via a pair of references that assign through to the underlying object. It's still undefined to mutate a const object, but clang doesn't optimize on this for data members, so this should be safe. Differential revision: https://reviews.llvm.org/D47607 llvm-svn: 333948
* Mark __c11_atomic_load as constJF Bastien2018-06-011-2/+2
| | | | | | | | | | | | | | | | | | | | | Summary: C++11 onwards specs the non-member functions atomic_load and atomic_load_explicit as taking the atomic<T> by const (potentially volatile) pointer. C11, in its infinite wisdom, decided to drop the const, and C17 will fix this with DR459 (the current draft forgot to fix B.16, but that’s not the normative part). This patch fixes the libc++ version of the __c11_atomic_load builtins defined for GCC's compatibility sake. D47618 takes care of the clang side. Discussion: http://lists.llvm.org/pipermail/cfe-dev/2018-May/058129.html <rdar://problem/27426936> Reviewers: EricWF, mclow.lists Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D47613 llvm-svn: 333776
* Mark __clear_and_shrink() as noexcept. This prevents the generation of a ↵Marshall Clow2018-05-291-2/+2
| | | | | | catch block and call to terminate in string's move assignment. Thanks to Howard for the 'catch'. llvm-svn: 333435
* LWG 2969 "polymorphic_allocator::construct() shouldn't pass resource()"Eric Fiselier2018-05-291-11/+11
| | | | | | | | | | | | | | | | | | | Patch from Arthur O'Dwyer. In the TS, `uses_allocator` construction for `pair` tried to use an allocator type of `memory_resource*`, which is incorrect because `memory_resource*` is not an allocator type. LWG 2969 fixed it to use `polymorphic_allocator` as the allocator type instead. https://wg21.link/lwg2969 (D47090 included this in `<memory_resource>`; at Eric's request, I've split this out into its own patch applied to the existing `<experimental/memory_resource>` instead.) Reviewed as https://reviews.llvm.org/D47109 llvm-svn: 333384
* Revert "Add nonnull; use it for atomics"JF Bastien2018-05-262-140/+23
| | | | | | | | | | | | | | That's r333325, as well as follow-up "Fix GCC handling of ATOMIC_VAR_INIT" r333327. Marshall asked to revert: Let's have a discussion about how to implement this so that it is more friendly to people with installed code bases. We've had *extremely* loud responses to unilaterally adding warnings - especially ones that can't be easily disabled - to the libc++ code base in the past. llvm-svn: 333351
* Add nonnull; use it for atomicsJF Bastien2018-05-252-23/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The atomic non-member functions accept pointers to std::atomic / std::atomic_flag as well as to the non-atomic value. These are all dereferenced unconditionally when lowered, and therefore will fault if null. It's a tiny gotcha for new users, especially when they pass in NULL as expected value (instead of passing a pointer to a NULL value). We can therefore use the nonnull attribute to denote that: - A warning should be generated if the argument is null - It is undefined behavior if the argument is null (because a dereference will segfault) This patch adds support for this attribute for clang and GCC, and sticks to the subset of the syntax both supports. In particular, work around this GCC oddity: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60625 The attributes are documented: - https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html - https://clang.llvm.org/docs/AttributeReference.html#nullability-attributes I'm authoring a companion clang patch for the __c11_* and __atomic_* builtins, which currently only warn on a subset of the pointer parameters. In all cases the check needs to be explicit and not use the empty nonnull list, because some of the overloads are for atomic<T*> and the values themselves are allowed to be null. <rdar://problem/18473124> Reviewers: arphaman, EricWF Subscribers: aheejin, christof, cfe-commits Differential Revision: https://reviews.llvm.org/D47225 llvm-svn: 333325
* Add deduction guides for optionalMarshall Clow2018-05-251-0/+9
| | | | llvm-svn: 333251
* Do not define template specialization __libcpp_is_floating_point<__fp16>Akira Hatanaka2018-05-231-0/+2
| | | | | | | | if the compiler is not clang. gcc doesn't allow using __fp16 on non-ARM targets. llvm-svn: 333108
* Teach __libcpp_is_floating_point that __fp16 and _Float16 areAkira Hatanaka2018-05-231-0/+4
| | | | | | | | floating-point types. rdar://problem/40377353 llvm-svn: 333103
* Implement deduction guides for basic_regexMarshall Clow2018-05-231-0/+14
| | | | llvm-svn: 333050
* Change the names of two private methods: allocate -> __vallocate and ↵Marshall Clow2018-05-221-41/+41
| | | | | | deallocate -> __vdeallocate. NFC. This change triggered by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61806, which shows up when we implement deduction guides for the container adaptors.The names have a 'v' in them because WIN32 has a macro named __deallocate. (sigh). llvm-svn: 332996
* Deduction guides for the container adaptors - queue, stack, and priority_queueMarshall Clow2018-05-222-0/+88
| | | | llvm-svn: 332927
* Implement deduction guides for vectorMarshall Clow2018-05-211-7/+28
| | | | llvm-svn: 332901
* Deduction guides for listMarshall Clow2018-05-201-2/+24
| | | | llvm-svn: 332818
* Implement deduction guides for forward_listMarshall Clow2018-05-191-0/+22
| | | | llvm-svn: 332811
* Implement deduction guides for <deque>Marshall Clow2018-05-181-3/+26
| | | | llvm-svn: 332785
* Implement deduction guides for <array>; Reviewed as ↵Marshall Clow2018-05-181-1/+12
| | | | | | https://reviews.llvm.org/D46964 llvm-svn: 332768
* Condition usage of locale stdlib functions on Android API versionPeter Collingbourne2018-05-161-7/+8
| | | | | | | | | | | | Some *_l functions were not available in some versions of Bionic. This CL checks that the NDK version supports the functions, and if not, falls back on the corresponding functions that don't take a locale. Patch by Tom Anderson! Differential Revision: https://reviews.llvm.org/D46558 llvm-svn: 332543
* Emit an error when include <atomic> after <stdatomic.h>Volodymyr Sapsai2018-05-151-0/+3
| | | | | | | | | | | | | | | | | | | | | C11 defines `kill_dependency` as a macro in <stdatomic.h>. When you include <atomic> after <stdatomic.h>, the macro clashes with `std::kill_dependency` and causes multiple errors. Explicit error should help in diagnosing those errors. No change for working code that includes <atomic> before <stdatomic.h>. rdar://problem/27435938 Reviewers: rsmith, EricWF, mclow.lists, jfb Reviewed By: jfb Subscribers: jfb, jkorous-apple, christof, bumblebritches57, JonChesterfield, smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D45470 llvm-svn: 332413
* Fix PR37407 - callable traits don't correctly check complete types.Eric Fiselier2018-05-101-142/+2
| | | | | | | | | | | | | Checking for complete types is really rather tricky when you consider the amount of specializations required to check a function type. This specifically caused PR37407 where we incorrectly diagnosed noexcept function types as incomplete (but there were plenty of other cases that would cause this). This patch removes the complete type checking for now. I'm going to look into adding a clang builtin to correctly do this for us. llvm-svn: 332040
* Allow copy elision in path concatenationDavid Bolvansky2018-05-091-1/+3
| | | | | | | | | | | | | | | | | Summary: Just port of libstdc++'s fix to libc++ fs: https://github.com/gcc-mirror/gcc/commit/e6ac4004fe49d785c63bf87aec4b095b5ce1d19f Author of fix: Jonathan Wakely Reviewers: EricWF, mclow.lists Reviewed By: EricWF Subscribers: smeenai, christof, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D46593 llvm-svn: 331910
* Revert "Emit an error when mixing <stdatomic.h> and <atomic>"Volodymyr Sapsai2018-05-081-3/+0
| | | | | | | It reverts commit r331379 because turned out `__ALLOW_STDC_ATOMICS_IN_CXX__` doesn't work well in practice. llvm-svn: 331818
* Emit an error when mixing <stdatomic.h> and <atomic>Volodymyr Sapsai2018-05-021-0/+3
| | | | | | | | | | | | | | | | | | | | | Atomics in C and C++ are incompatible at the moment and mixing the headers can result in confusing error messages. Emit an error explicitly telling about the incompatibility. Introduce the macro `__ALLOW_STDC_ATOMICS_IN_CXX__` that allows to choose in C++ between C atomics and C++ atomics. rdar://problem/27435938 Reviewers: rsmith, EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: jkorous-apple, christof, bumblebritches57, JonChesterfield, smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D45470 llvm-svn: 331379
* Fix return type of isinf(double) and isnan(double) where possible.Richard Smith2018-05-011-0/+28
| | | | | | | | | | | When using an old version of glibc, a ::isinf(double) and ::isnan(double) function is provided, rather than just the macro required by C and C++. Displace this function using _LIBCPP_PREFERRED_OVERLOAD where possible. The only remaining case where we should get the wrong return type is now glibc + libc++ + a non-clang compiler. llvm-svn: 331241
* [libcxx] func.wrap.func.con: Unset function before destroying anythingVolodymyr Sapsai2018-04-252-29/+42
| | | | | | | | | | | | | | | | | | | | Be defensive against a reentrant std::function::operator=(nullptr_t), in case the held function object has a non-trivial destructor. Destroying the function object in-place can lead to the destructor being called twice. Patch by Duncan P. N. Exon Smith. C++03 support by Volodymyr Sapsai. rdar://problem/32836603 Reviewers: EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits, arphaman Differential Revision: https://reviews.llvm.org/D34331 llvm-svn: 330885
* Fix static initialization of std::atomic_flag; Fixes PR#37226. Thanks to ↵Marshall Clow2018-04-251-1/+1
| | | | | | Ricky Zhou for the report and test case. llvm-svn: 330828
* Re-commit r330627 "[libcxx] implement <experimental/simd> declarations based ↵Tim Shen2018-04-233-0/+1301
| | | | | | | | | | | | on P0214R7." There are 3 changes: * Renamed genertor.pass.cpp to generator.pass.cpp * Removed nothing_to_do.pass.cpp * Mark GCC 4.9 as UNSUPPORTED for the test files that have negative narrowing conversion SFINAE test (see GCC PR63723). llvm-svn: 330655
* Revert "[libcxx] implement <experimental/simd> declarations based on P0214R7."Tim Shen2018-04-233-1301/+0
| | | | | | | | This reverts commit r330627. This causes several bots to freak out. llvm-svn: 330636
* [libcxx] implement <experimental/simd> declarations based on P0214R7.Tim Shen2018-04-233-0/+1301
| | | | | | | | | | | | | | | Summary: The patch includes all declarations, and also implements the following features: * ABI. * narrowing-conversion related SFIANE, including simd<> ctors and (static_)simd_cast. Reviewers: mclow.lists, EricWF Subscribers: lichray, sanjoy, MaskRay, cfe-commits Differential Revision: https://reviews.llvm.org/D41148 llvm-svn: 330627
* Don't do aligned allocations on MSVCRT before 19.12 (update 15.3)Reid Kleckner2018-04-191-0/+6
| | | | | | | | | | Reviewers: EricWF, pcc Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D45836 llvm-svn: 330372
* Remove impossible _MSC_VER checkReid Kleckner2018-04-191-3/+0
| | | | | | | | | | | | | | | | Summary: It is immediately preceded by this check: #if _MSC_VER < 1900 #error "MSVC versions prior to Visual Studio 2015 are not supported" #endif Reviewers: EricWF Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D45829 llvm-svn: 330360
* support: add missing locale stubs for android L, MSaleem Abdulrasool2018-04-132-5/+38
| | | | | | | | | The strto* family was introduced in android O (API Level 26). However, the support headers were adjusted to indicate that all locale aware functions were added in L. Provide stubs for the locale aware strto* family until O. llvm-svn: 330045
* [libcxx] Set ABI version 2 as default for FuchsiaPetr Hosek2018-04-111-1/+5
| | | | | | | | | | This avoids the need for a custom generated config file which is desired because the custom config files differs per-target which means we cannot reuse headers across different targets. Differential Revision: https://reviews.llvm.org/D45304 llvm-svn: 329770
* Revert "[CMake] Use custom command and target to install libc++ headers"Petr Hosek2018-04-091-219/+32
| | | | | | This reverts commit r329544 which is failing on libcxx standalone bots. llvm-svn: 329545
* [CMake] Use custom command and target to install libc++ headersPetr Hosek2018-04-091-32/+219
| | | | | | | | | | | | | | | | | | | Using file(COPY FILE...) has several downsides. Since the file command is only executed at configuration time, any changes to headers made after the initial CMake execution are ignored. This can lead to subtle errors since the just built Clang will be using stale libc++ headers. Furthermore, since the headers are copied prior to executing the build system, this may hide missing dependencies on libc++ from other LLVM components. This changes replaces the use of file(COPY FILE...) command with a custom command and target which addresses all aforementioned issues and matches the implementation already used by other LLVM components that also install headers like Clang builtin headers. Differential Revision: https://reviews.llvm.org/D44773 llvm-svn: 329544
* Use void() to create a void expression typeEric Fiselier2018-04-071-1/+1
| | | | llvm-svn: 329484
* Work around missing braces in init warningEric Fiselier2018-04-071-1/+1
| | | | llvm-svn: 329474
* Implement P0768r1: Library support for the Spaceship Operator.Eric Fiselier2018-04-064-1/+688
| | | | | | | | | | | | this patch adds the <compare> header and implements all of it except for [comp.alg]. As I understand it, the header is needed by the compiler in when implementing the semantics of operator<=>. For that reason I feel it's important to land this header early, despite all compilers lacking support. llvm-svn: 329460
* [coroutines] libcxx, noop_coroutine, make bots even more happyGor Nishanov2018-04-051-3/+3
| | | | llvm-svn: 329245
* [coroutines] Allow compilation under c++03Gor Nishanov2018-04-041-1/+1
| | | | llvm-svn: 329239
* [coroutines] Add noop_coroutine to <experimental/coroutine>Gor Nishanov2018-04-041-29/+68
| | | | | | | | | | | | | | A recent addition to Coroutines TS (https://wg21.link/p0913) adds a pre-defined coroutine noop_coroutine that does nothing. This patch implements require library types in <experimental/coroutine> Related clang and llvm patches: https://reviews.llvm.org/D45114 https://reviews.llvm.org/D45120 llvm-svn: 329237
* Touch up tests for new <version> header; fix module.modulemap.Eric Fiselier2018-04-041-0/+4
| | | | | | | | | | | This patch does some housekeeping for the new <version> header. It adds it to the module.modulemap, and the double_include.sh.cpp test. Additionally it corrects the // UNSUPPORTED options for the libc++ specific test. The header needs to compile under C++03 to support modules, and it should compile under all available compilers. llvm-svn: 329144
* Implement P0754R2: The <version> header.Marshall Clow2018-04-031-0/+25
| | | | llvm-svn: 329075
* Implement P0430R2 - File system library on non-POSIX systems.Eric Fiselier2018-04-021-5/+14
| | | | | | | | | | | This patch implements P0430R2, who's largest change is adding the path::format enumeration for supporting path format conversions in path constructors. However, since libc++'s filesystem only really supports POSIX like systems, there are no real changes needed. This patch simply adds the format enum and then ignores it when it's passed to constructors. llvm-svn: 329031
* Implement filesystem NB comments, relative paths, and related issues.Eric Fiselier2018-04-021-46/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a fairly large patch that implements all of the filesystem NB comments and the relative paths changes (ex. adding weakly_canonical). These issues and papers are all interrelated so their implementation couldn't be split up nicely. This patch upgrades <experimental/filesystem> to match the C++17 spec and not the published experimental TS spec. Some of the changes in this patch are both API and ABI breaking, however libc++ makes no guarantee about stability for experimental implementations. The major changes in this patch are: * Implement NB comments for filesystem (P0492R2), including: * Implement `perm_options` enum as part of NB comments, and update the `permissions` function to match. * Implement changes to `remove_filename` and `replace_filename` * Implement changes to `path::stem()` and `path::extension()` which support splitting examples like `.profile`. * Change path iteration to return an empty path instead of '.' for trailing separators. * Change `operator/=` to handle absolute paths on the RHS. * Change `absolute` to no longer accept a current path argument. * Implement relative paths according to NB comments (P0219r1) * Combine `path.cpp` and `operations.cpp` since some path functions require access to the operations internals, and some fs operations require access to the path parser. llvm-svn: 329028
* Fix PR36914 - num_get::get(unsigned) incorrectly handles negative numbers.Eric Fiselier2018-03-291-7/+8
| | | | | | | | | This patch corrects num_get for unsigned types to support strings with a leading `-` character. According to the standard the number should be parsed as an unsigned integer and then negated. llvm-svn: 328751
OpenPOWER on IntegriCloud