Commit Graph

978 Commits

Author SHA1 Message Date
Marshall Clow
6027993c28 K-Ballo found a place where we were using 'V' as a template parameter. Replace with '_Vp' for protection against user-defined macros.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225527 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 17:03:36 +00:00
Marshall Clow
fd8ed7fa85 Fix PR 22106; make std::swap work for multi-dimensional arrays. Thanks to Peter Griess for the report and suggested fix
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225285 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 19:20:49 +00:00
Dan Albert
c101738156 Obey [atomics.types.operations.req]/21 for GCC.
Summary:
Excerpt from [atomics.types.operations.req]/21:

> When only one memory_order argument is supplied, the value of
> success is order, and the value of failure is order except that a
> value of memory_order_acq_rel shall be replaced by the value
> memory_order_acquire and a value of memory_order_release shall be
> replaced by the value memory_order_relaxed.

Clean up some copy pasta while I'm here (someone added a return
statement to a void function).

Reviewers: EricWF, jroelofs, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6632

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225280 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 18:39:37 +00:00
Dan Albert
656850f03e [libcxx] Set _LIBCPP_ELAST for mingw.
Reviewers: K-ballo, mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: jfb, jroelofs, majnemer, cfe-commits

Differential Revision: http://reviews.llvm.org/D6558

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225273 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 17:34:51 +00:00
Eric Fiselier
60b3df404e Prevent ill-formed instantiation of __invoke_of<...> during the evaluation of a bind expression. Fixes PR22003.
The SFINAE on the function __mu(Fn, Args...) that evaluates nested bind
expressions always tries to deduce the return type for Fn(Args...) even when Fn
is not a nested bind expression. This can cause hard compile errors when the
instantation of Fn(Args...) is ill-formed. This patch prevents the instantation
of __invoke_of<Fn, Args...> unless Fn is actually a bind expression.

Bug reportand patch from Michel Morin.

http://llvm.org/bugs/show_bug.cgi?id=22003


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224753 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-23 05:54:34 +00:00
Marshall Clow
0b16e8e05a Fix PR22000. __bit_iterator::move_backwards. Also make a note that __bit_iterator
is quite underrepresented in the libc++ tests suite.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224723 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-22 19:10:11 +00:00
Eric Fiselier
669a8a5a19 [libcxx] Add <experimental/type_traits> for LFTS
Summary:
This adds the <experimental/type_traits> (minus invocation traits). Mostly just the `_v` traits.


Reviewers: K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5742

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224626 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19 22:21:44 +00:00
Marshall Clow
e3e7054f48 Implement LWG 2217 - operator==(sub_match, string) slices on embedded '\0's
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224292 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 23:57:56 +00:00
Eric Fiselier
9acbcee2c6 Add option to turn off installation of headers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224162 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 22:52:58 +00:00
Sergey Dmitrouk
984f8f6e43 Include newlib-specific locales in __locale
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224111 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 08:36:16 +00:00
Marshall Clow
4ad67e08cb Add all the relational operators to std::experimental::optional. Also update bad_optional_access to match the Library Fundamentals draft standard. This is not all of the upcoming changes to optional, though.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223775 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09 14:49:17 +00:00
Sergey Dmitrouk
fff544efbd Explicitly include <sched.h> for sched_yield()
It might be implicitly included by <pthread.h> (and that's why it worked
so far), but it's not guaranteed (for example, this is not the case with
newlib).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223661 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-08 14:50:21 +00:00
Eric Fiselier
a245f9b263 Improve error message when _LIBCPP_HAS_NO_MONOTONIC_CLOCK is used improperly
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223590 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-06 20:09:11 +00:00
JF Bastien
2bd5ffd330 libc++: add NaCl and PNaCl support for std::random_device
Summary:
The NaCl sandbox doesn't allow opening files under /dev, but it offers an API which provides the same capabilities. This is the same random device emulation that nacl_io performs for POSIX support, but nacl_io is an optional library so libc++ can't assume that device emulation will be performed. Note that NaCl only supports /dev/urandom, not /dev/random.

This patch also cleans up some of the preprocessor #endif, and fixes the test for Win32 (it accepts any token, and would therefore never throw regardless of the token provided).

Test Plan: ninja check-libcxx

Reviewers: dschuff, mclow.lists, danalbert

Subscribers: jfb, cfe-commits

Differential Revision: http://reviews.llvm.org/D6442

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223068 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 19:19:55 +00:00
JF Bastien
6317e9b85a libc++: integral types trap on PNaCl
Reviewers: dschuff, danalbert

    Subscribers: jfb, cfe-commits

    Differential Revision: http://reviews.llvm.org/D6411

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222842 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-26 17:51:58 +00:00
Eric Fiselier
6cb69ffa0a Fixes to get libc++ building on sun solaris. Patch from C Bergstrom.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222794 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 21:57:41 +00:00
Marshall Clow
03c6791dc6 Implement N4280 - 'Non-member size() and more'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222378 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 19:43:23 +00:00
Marshall Clow
4b3ca8c249 Implement LWG2400 - 'shared_ptr's get_deleter() should use addressof()', and add tests. Mark LWG2400 and LWG2404 as complete
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222161 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 19:05:50 +00:00
Marshall Clow
88aae920ef Implement void_t from N3911. Add a private version for use in the library before C++1z. Update the 1z status page, marking a bunch of issues that don't require library changes as complete (2129, 2212, 2230, 2233, 2325, 2365, 2376)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222138 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 15:50:08 +00:00
Eric Fiselier
d759095887 [libcxx] Fix vector annotator size increase in vector::insert(pos, count, value)
Summary:
The size of the vector is being increased by `__n` during the call to `__move_range` and not by 1.
This fixes a test failure in `containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp` when using ASAN.

Reviewers: danalbert, kcc, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6264

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222014 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 18:28:36 +00:00
Marshall Clow
1cf810b81b Replaced checking in string_view::remove_suffix/remove_prefix by _LIBCPP_ASSERT, since this is technically undefined behavior. Fixes PR#21496
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221717 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-11 22:07:10 +00:00
Marshall Clow
3f5579f0b2 Fix typo in allocator_traits::construct. This fixes PR14175, which shows up if an allocator has a no-args construct method
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221697 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-11 19:22:33 +00:00
Eric Fiselier
b6e0ef2deb Fix rvalue bug in __has_operator_addressof
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221398 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-05 21:20:10 +00:00
Eric Fiselier
341b59021c Fix operator & detection trait to check for free function overloads as well
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221395 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-05 20:59:18 +00:00
Marshall Clow
26aa8c9254 Mark string_view::to_string as const. Fixes PR21428
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221101 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-02 15:35:32 +00:00
Eric Fiselier
522aaf67ea [libcxx] Delay evaluation of __make_tuple_types to prevent blowing the max template instantiation depth. Fixes Bug #18345
Summary:
http://llvm.org/bugs/show_bug.cgi?id=18345

Tuple's constructor and assignment operators for "tuple-like" types evaluates __make_tuple_types unnecessarily. In the case of a large array this can blow the template instantiation depth.

Ex:
```
#include <array>
#include <tuple>
#include <memory>
 
typedef std::array<int, 1256> array_t;
typedef std::tuple<array_t> tuple_t;

int main() {
  array_t a;
  tuple_t t(a); // broken
  t = a; // broken

  // make_shared uses tuple behind the scenes. This bug breaks this code.
  std::make_shared<array_t>(a);
}
```

To prevent this from happening we delay the instantiation of `__make_tuple_types` until after we perform the length check. Currently `__make_tuple_types` is instantiated at the same time that the length check .


Test Plan: Two tests have been added. One for the "tuple-like" constructors and another for the "tuple-like" assignment operator. 

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: K-ballo, cfe-commits

Differential Revision: http://reviews.llvm.org/D4467

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220769 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-28 06:31:22 +00:00
Eric Fiselier
bff83f9aab [libcxx] use clang's __char16_t and __char32_t definitions on Linux in C++03 mode.
Summary: This fixes ODR violations in C++03 mode in test/localization/locale.stdcvt. The special case for linux was introduced in 2010 before clang always defined __char16_t and __char32_t.

Reviewers: mclow.lists, danalbert, jroelofs, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5930

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220716 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 20:29:05 +00:00
Eric Fiselier
62a0e01343 Fix use of operator comma in is_permutation and delete comma operator for test iterators.
The comma operators in the test iterators give better error messages when they
are deleted as opposed to not defined. Delete these functions when possible.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220715 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 20:26:25 +00:00
Eric Fiselier
b991975439 [libcxx] Fix use of operator comma where the types can be user defined
Summary:
An evil user might overload operator comma. Use a void cast to make sure any user overload is not selected.
Modify all the test iterators to define operator comma. 

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5929

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220706 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 19:28:20 +00:00
Marshall Clow
1d306de1a7 PR #21321 talked about implementation-defined behavior of realloc. I poo-poohed it, and was wrong. Fix the call in <locale>. Review the others, refactored some duplicated code, and found overflow bugs (and __event_cap_ was never getting updated, either).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220702 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 19:08:10 +00:00
Marshall Clow
129e07fe99 Change the comment on the closing #endif to match the condition on the corresponding #ifdef. Thanks to K-ballo for the catch. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220647 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-26 20:29:38 +00:00
Justin Bogner
a0ab096796 Make headers available in the build directory
This essentially re-does r194825 and makes it possible to run clang
with libc++ without having to install it, even if you don't have any
version of libc++ installed in /usr/.

This behaviour broke in r210577/r211629, which fixed pr18681.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220489 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 16:51:12 +00:00
Eric Fiselier
4d2413ca4b Add support for "fancy" pointers to promise and packaged_task.
Summary:
This patch is very closely related to D4859. Please see http://reviews.llvm.org/D4859 for more information.

This patch adds support for "fancy" pointers and allocators to promise and packaged_task. The changes made to support this are exactly the same as in D4859.



Test Plan: "fancy" pointer tests were added to each constructor affected by the change.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4862

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220471 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 06:24:45 +00:00
Eric Fiselier
4e7d53664d Add support for "fancy" pointers to shared_ptr. Fixes PR20616
Summary:
This patch add support for "fancy pointers/allocators" as well as fixing support for shared_pointer and "minimal" allocators.

Fancy pointers are class types that meet the NullablePointer requirements. In our case they are created by fancy allocators. `support/min_allocator.h` is an archetype for these types.

There are three types of changes made in this patch:
1. `_Alloc::template rebind<T>::other` -> `__allocator_traits_rebind<_Alloc, T>::type`. This change was made because allocators don't need a rebind template. `__allocator_traits_rebind` is used instead of `allocator_traits::rebind` because use of `allocator_traits::rebind` requires a workaround for when template aliases are unavailable.
2. `a.deallocate(this, 1)` -> `a.deallocate(pointer_traits<self>::pointer_to(*this), 1)`. This change change is made because fancy pointers aren't always constructible from raw pointers. 
3. `p.get()` -> `addressof(*p.get())`. Fancy pointers aren't actually a pointer. When we need a "real" pointer we take the address of dereferencing the fancy pointer. This should give us the actual raw pointer.

Test Plan: Tests were added using `support/min_allocator.h` to each affected shared_ptr overload and creation function. These tests can only be executed in C++11 or greater since min_allocator is only available then. A extra test was added for the non-variadic versions of allocate_shared. 

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4859

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220469 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 04:12:28 +00:00
Marshall Clow
38d9005902 Whitespace maintenance. Remove a bunch of tabs that snuck in. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220142 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-18 11:03:33 +00:00
Eric Fiselier
950ee77d24 [libcxx] Fix SFINAE in <cmath>. Patch from K-Ballo.
Delay instantiation of `__numeric_type` within <cmath>, 
don't instantiate it when the `is_arithmetic` conditions do not hold as it causes
errors with user-defined types with ambiguous conversions. Fixes PR21083.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219998 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-17 00:31:47 +00:00
Marshall Clow
bbc7c74fbb Fixes PR21157 'tuple: non-default constructible tuple hard failure' Thanks to Louis Dionne for the bug report and the patch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219785 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-15 10:33:02 +00:00
Marshall Clow
df9722ecf1 Fix for PR 19616: 'tuple_cat of nested tuples fails in noexcept specification'. Thanks to Louis Dionne for the fix.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219243 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-07 21:42:12 +00:00
Dan Albert
4c88839716 Fix win32 support header for mingw32.
These functions are defined as static in the mingw32 headers.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219140 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-06 20:06:33 +00:00
Nico Weber
8758796fc9 Mark module atomic as cplusplus11.
With clang, the header atomic requires __has_feature(cxx_atomic), which is only
true in c++11 mode. Because of this, when using modules in c++98 with libc++
compilation of the std module would fail without this change, PR21002.

(With gcc, only gcc4.7+ is needed, no c++11. But gcc doesn't have modules yet,
and the module.modulemap language can't express things like "this is only
required if the compiler is clang". If gcc gets module support, we'd probably
have a module.modulemap file for each compiler that libc++ supports?)


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@218372 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-24 04:44:54 +00:00
Marshall Clow
d132bf4ef1 Fix some type-traits (is_assignable, etc) dealing with classes that take non-const references as 'right hand side'. Add tests. Fixes PR# 20836
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@218286 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-22 23:58:00 +00:00
Jonathan Roelofs
6a5a8abe2f Support newlib as libc++'s C library [locale part]
http://reviews.llvm.org/D5385


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@218144 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-19 20:09:12 +00:00
Marshall Clow
5ffb8d0fbe Fix PR#20843: binomial_distribution<unsigned> is broken. Add test to ensure that signed and unsigned verstions produce the same sequence.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217976 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 18:33:58 +00:00
Dan Albert
6d9505ad8a Fix char_traits functions for GCC compatibility.
GCC 4.9 fails to inline these functions at -O1 because they are used
indirectly. Declare them as inline instead of always_inline. Discussion
in GCC bugreport: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63220


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217961 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 16:34:29 +00:00
Marshall Clow
bb9902ec97 K-ballo pointed out *another* mistype in my change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217936 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 01:58:15 +00:00
Marshall Clow
d402a4da6b Fix for mismatch to handle evil iterators which overload operator comma
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217903 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 20:40:05 +00:00
Marshall Clow
4413ab09d5 Fix a bug in the move-assigment operator for basic_stringbuf. Thanks to Johnathan Wakeley for the bug report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217894 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 18:57:52 +00:00
Marshall Clow
86d311c5f3 Thanks to K-ballo for noting a second incorrect noexcept clause in tuple - and suggesting a more correct way to write the first
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217884 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 17:08:21 +00:00
Marshall Clow
12929a957b Fix a bad noexcept clause in tuple's move constructor
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217878 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 15:36:14 +00:00
Marshall Clow
d1fae17224 Forgot 'const' on my last checkin
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217877 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-16 15:33:53 +00:00