Commit Graph

1883 Commits

Author SHA1 Message Date
Roger Ferrer Ibanez 8a915ed644 Protect exceptional paths under libcpp-no-exceptions
These tests are of the form

try {
   action-that-may-throw
   assert(!exceptional-condition)
   assert(some-other-facts)
 } catch (relevant-exception) {
   assert(exceptional-condition)
 }

Under libcpp-no-exceptions there is still value in verifying
some-other-facts while avoiding the exceptional case. So for these tests
just conditionally check some-other-facts if exceptional-condition is
false. When exception are supported make sure that a true
exceptional-condition throws an exception

Differential Revision: https://reviews.llvm.org/D26136

llvm-svn: 285697
2016-11-01 15:46:16 +00:00
Roger Ferrer Ibanez 60d6ef63a4 Protect lock tests under libcpp-no-exceptions
Skip tests that expect an exception to be thrown.

Differential Revision: https://reviews.llvm.org/D26184

llvm-svn: 285695
2016-11-01 15:00:16 +00:00
Roger Ferrer Ibanez 8cba0befb4 Protect tests that expect an exception for an unknown std::random_device
Skip these tests under libcpp-no-exceptions.

Differential Revision: https://reviews.llvm.org/D26141

llvm-svn: 285677
2016-11-01 08:11:12 +00:00
Roger Ferrer Ibanez c6a40d24d0 Fix archetypes.hpp under libcpp-no-extensions and std level < 14
Under -fno-exceptions TEST_THROW becomes abort / __builtin_abort which returns
void. This causes a type mismatch in the conditional operator when testing the
library in C++98,03,11 modes.

Use a comma operator to workaround this problem.

Differential Revision: https://reviews.llvm.org/D26147

llvm-svn: 285572
2016-10-31 14:14:13 +00:00
Roger Ferrer Ibanez 3565c96d86 Change from "XFAIL: libcpp-no-exceptions" to "UNSUPPORTED: libcpp-no-exceptions" tests that only check exceptions and nothing else
This is a follow up of D24562.

These tests do not check anything but exceptions, so it makes sense to mark
them as UNSUPPORTED under a library built without exceptions.

Differential Revision: https://reviews.llvm.org/D26075

llvm-svn: 285550
2016-10-31 08:47:53 +00:00
Eric Fiselier 7ca76565e7 Fix _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY to always have default visibility.
This prevent the symbols from being both externally available and hidden, which
causes them to be linked incorrectly. This is only a problem when the address
of the function is explicitly taken since it will always be inlined otherwise.

This patch fixes the issues that caused r285456 to be reverted, and can
now be reapplied.

llvm-svn: 285531
2016-10-31 02:07:23 +00:00
Eric Fiselier 1467a197e5 Rewrite std::filesystem::path iterators and parser
This patch entirely rewrites the parsing logic for paths. Unlike the previous
implementation this one stores information about the current state; For example
if we are in a trailing separator or a root separator. This avoids the need for
extra lookahead (and extra work) when incrementing or decrementing an iterator.
Roughly this gives us a 15% speedup over the previous implementation.

Unfortunately this implementation is still a lot slower than libstdc++'s.
Because libstdc++ pre-parses and splits the path upon construction their
iterators are trivial to increment/decrement. This makes libc++ lazy parsing
100x slower than libstdc++. However the pre-parsing libstdc++ causes a ton
of extra and unneeded allocations when constructing the string. For example
`path("/foo/bar/")` would require at least 5 allocations with libstdc++
whereas libc++ uses only one. The non-allocating behavior is much preferable
when you consider filesystem usages like 'exists("/foo/bar/")'.

Even then libc++'s path seems to be twice as slow to simply construct compared
to libstdc++. More investigation is needed about this.

llvm-svn: 285526
2016-10-30 23:30:38 +00:00
Eric Fiselier d03a5ffcf6 Remove files missed in r285466
llvm-svn: 285469
2016-10-28 22:54:24 +00:00
Eric Fiselier a32a961b10 Fix test when using an installed libc++
llvm-svn: 285392
2016-10-28 11:01:12 +00:00
Eric Fiselier 64428acf41 Add more tests for optional<const T>
llvm-svn: 285384
2016-10-28 06:40:29 +00:00
Eric Fiselier 761e42fa3d Add __libcpp_version file and __libcpp_library_version function.
This patch does two seperate things. First it adds a file called
"__libcpp_version" which only contains the current libc++ version
(currently 4000). This file is not intended for use as a header. This file
is used by Clang in order to easily determine the installed libc++ version.
This allows Clang to enable/disable certain language features only when the
library supports them.

The second change is the addition of _LIBCPP_LIBRARY_VERSION macro, which
returns the version of the installed dylib since it may be different than
the headers.

llvm-svn: 285382
2016-10-28 06:06:50 +00:00
Tim Shen e776667441 [libcxx] Make regex_match backtrack when search fails
Summary:
Fixes PR19851.
alg.re.match/ecma.pass.cpp still XFAILS on linux, but after commenting out
locale-related tests, it passes. I don't have a freebsd machine to produce a
full pass.

Reviewers: mclow.lists

Subscribers: cfe-commits, emaste

Differential Revision: https://reviews.llvm.org/D26026

llvm-svn: 285352
2016-10-27 21:40:34 +00:00
Stephan T. Lavavej 50b80c36fa [PATCH] D25483: [libcxx] [test] Fix non-Standard assumptions about how many elements are allocated
llvm-svn: 285346
2016-10-27 21:25:12 +00:00
Casey Carter be65b24a55 Cleanup nonportable behavior in tests for std::any
Fixes MS issues 63, 64, and 65.

test/std/utilities/any/any.class/any.cons/move.pass.cpp:
* "Moves are always destructive" is not a portable assumption; check with LIBCPP_ASSERT.

test/std/utilities/any/any.class/any.cons/value.pass.cpp:
* The standard does not forbid initializing std::any from any pointer-to-function type. Remove the non-conforming "DecayTag" test.

test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp:
* Self-swap is not specified to perform no moves; check with LIBCPP_ASSERT.

Differential Revision: https://reviews.llvm.org/D26007

llvm-svn: 285234
2016-10-26 20:18:13 +00:00
Casey Carter 9450d5e262 Silence unused parameter warnings in archetypes.hpp
Reviewed at: https://reviews.llvm.org/D25958

llvm-svn: 285213
2016-10-26 17:22:25 +00:00
Eric Fiselier 8f29ea36c3 Fix nullptr tests
llvm-svn: 285117
2016-10-25 20:45:17 +00:00
Eric Fiselier a905007f12 Fix non-portable tests for temp_directory_path(...)
llvm-svn: 285020
2016-10-24 20:40:35 +00:00
Eric Fiselier 4d4c79d8f5 Add missing include in string_view tests. Patch from Billy ONeil @ microsoft
llvm-svn: 285012
2016-10-24 20:11:17 +00:00
Eric Fiselier 009fb08d14 Fix shadow warnings in string_view tests. Patch from STL@microsoft.com
llvm-svn: 285011
2016-10-24 20:10:00 +00:00
Eric Fiselier d11fdad33e Backout enabling -Wshadow until I have time to fix the breakage
llvm-svn: 284952
2016-10-23 22:24:11 +00:00
Eric Fiselier 81a09f2c9e Fix libc++ specific assertion in permissions(...) tests
llvm-svn: 284945
2016-10-23 19:14:58 +00:00
Eric Fiselier b51325cefe Turn on -Wshadow so I find occurances before STL does
llvm-svn: 284944
2016-10-23 19:01:10 +00:00
Eric Fiselier 1e96d5380e Make make_from_tuple tests more portable. Patch from STL@microsoft.com
llvm-svn: 284943
2016-10-23 18:55:51 +00:00
Eric Fiselier eca753ad92 Fix unreferenced parameters. Patch from STL@microsoft.com
llvm-svn: 284942
2016-10-23 18:52:58 +00:00
Eric Fiselier d06ee7706c Fix shadowing warning. Patch from STL@microsoft.com
llvm-svn: 284941
2016-10-23 18:47:58 +00:00
Tim Shen abd1a6e687 [libcxx] Support std::regex_constants::match_not_null
Summary: Fixes PR21597.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25595

llvm-svn: 284881
2016-10-21 20:41:47 +00:00
Marshall Clow c1b73a1793 Adding a missing constexpr test for reverse_iterator operator[].
llvm-svn: 284731
2016-10-20 14:57:34 +00:00
Eric Fiselier db94496629 Attempt to workaround XPASS for aligned allocation tests
llvm-svn: 284691
2016-10-20 03:31:07 +00:00
Marshall Clow 1b8f260ed9 Implement constexpr support for reverse_iterator. Reviewed as https://reviews.llvm.org/D25534
llvm-svn: 284602
2016-10-19 15:12:50 +00:00
Eric Fiselier c5777f4d58 Make any_cast<void()>(nullptr) compile
llvm-svn: 284333
2016-10-16 11:56:38 +00:00
Eric Fiselier f72aaff994 Update LWG 2767 and add test case
llvm-svn: 284324
2016-10-16 03:45:06 +00:00
Eric Fiselier 015fcffd57 Update status for std::optional LWG issues and fix an optional SFINAE bug
llvm-svn: 284323
2016-10-16 03:21:35 +00:00
Eric Fiselier 50253ed1c6 Update issue status for LWG 2744
llvm-svn: 284322
2016-10-16 02:51:50 +00:00
Eric Fiselier 9c737fddba Update issue status for LWG 2768 and 2769
llvm-svn: 284321
2016-10-16 01:43:43 +00:00
Eric Fiselier ecafa8739e Implement LWG 2712 and update other issues status
llvm-svn: 284318
2016-10-16 00:47:59 +00:00
Eric Fiselier ae4c3e1699 Implement LWG 2681 and 2682
llvm-svn: 284316
2016-10-16 00:29:22 +00:00
Eric Fiselier 9ada18b339 Implement LWG 2672.
llvm-svn: 284314
2016-10-15 23:05:04 +00:00
Eric Fiselier 87ee8a0adb Implement modified LWG 2665
llvm-svn: 284313
2016-10-15 22:37:42 +00:00
Eric Fiselier bbcfec7edd Implement LWG2664 and update its status
llvm-svn: 284310
2016-10-15 21:29:44 +00:00
Eric Fiselier d2003575ce Prevent new/delete replacement tests from being optimized away.
llvm-svn: 284289
2016-10-14 22:47:08 +00:00
Eric Fiselier 797cb4f646 Clarify XFAIL comments
llvm-svn: 284282
2016-10-14 21:30:35 +00:00
Eric Fiselier 68696836d1 Work around Clang driver segfault when --coverage is used with -c and /dev/null
llvm-svn: 284225
2016-10-14 10:30:33 +00:00
Eric Fiselier 81b13934c1 XFAIL aligned allocation tests for older Clang versions
llvm-svn: 284214
2016-10-14 08:47:09 +00:00
Eric Fiselier 73bfe423fe XFAIL aligned allocation test failures with UBSAN
llvm-svn: 284210
2016-10-14 07:49:15 +00:00
Eric Fiselier 498ee00a3a Add void_t and invoke feature test macros
llvm-svn: 284209
2016-10-14 07:19:52 +00:00
Eric Fiselier 0ae4f23fdc Implement P0035R4 -- Add C++17 aligned allocation functions
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
2016-10-14 06:46:30 +00:00
Marshall Clow 6ecac73019 Implement http://wg21.link/p0302r1: Removing Allocator Support in std::function. These functions never worked, and as far as I know, no one ever called them.
llvm-svn: 284164
2016-10-13 21:06:03 +00:00
Marshall Clow bb1db210a8 Add missing include in test; NFC. Thanks to Jonathan Wakely for the report.
llvm-svn: 284120
2016-10-13 13:21:38 +00:00
Dimitry Andric ca2ab4f657 Disable trivial pair copy/move tests when unsupported
Summary:
On FreeBSD, for ABI compatibility reasons, the pair trivial copy
constructor is disabled, using the aptly-named
`_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR` define.

Disable the related tests when this define is on, so they don't fail
unexpectedly.

Reviewers: emaste, rsmith, theraven, EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25449

llvm-svn: 284047
2016-10-12 20:26:47 +00:00
Eric Fiselier a9fcc1d2a4 Correctly grant rebound limited_allocators friendship.
llvm-svn: 284006
2016-10-12 11:35:37 +00:00
Eric Fiselier 609fb0cc40 Remove incorrect XFAILS
llvm-svn: 284005
2016-10-12 11:29:18 +00:00
Eric Fiselier d2c71a923e Unbreak C++03 build
llvm-svn: 284004
2016-10-12 11:20:27 +00:00
Eric Fiselier 6b42540756 Remove usages of _LIBCPP_CONSTEXPR under test/std
llvm-svn: 284002
2016-10-12 10:28:09 +00:00
Eric Fiselier 6ce45e0840 Remove usages of _ALIGNAS_TYPE
llvm-svn: 283999
2016-10-12 10:19:48 +00:00
Eric Fiselier 1b9327f332 support --param=std=gnu++XX
llvm-svn: 283997
2016-10-12 09:53:35 +00:00
Eric Fiselier 1c3203a2c1 Fix more C++11 constexpr issues in the tests
llvm-svn: 283996
2016-10-12 09:48:44 +00:00
Eric Fiselier 883cc25d9f Fix nasty_containers.hpp for other stdlibs
llvm-svn: 283994
2016-10-12 09:31:26 +00:00
Eric Fiselier 9b480b07f9 Fix use of C++14 constexpr in C++11
llvm-svn: 283993
2016-10-12 09:20:58 +00:00
Eric Fiselier 5e931dd232 Remove use of _VSTD::__invoke in the not_fn tests
llvm-svn: 283991
2016-10-12 09:06:12 +00:00
Eric Fiselier 411e1f8288 Protect special members of NullBase archetype to avoid exposing them
llvm-svn: 283983
2016-10-12 08:09:22 +00:00
Eric Fiselier a9e659619f Implement N4606 optional
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
2016-10-12 07:46:20 +00:00
Eric Fiselier fc647db3ee Revert Add <optional>. Will recommit with better commit message
llvm-svn: 283978
2016-10-12 06:48:31 +00:00
Eric Fiselier 6ee4001cc9 Add <optional> header.
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
2016-10-12 06:45:11 +00:00
Eric Fiselier 49a278fb6d Fix two more tests that hang when testing against libstdc++
llvm-svn: 283976
2016-10-12 04:56:23 +00:00
Eric Fiselier 76e316f995 Prevent the test suite from hanging when run against libstdc++
llvm-svn: 283975
2016-10-12 04:29:50 +00:00
Eric Fiselier e04aebe904 Add mork workarounds for running the test suite against libstdc++
llvm-svn: 283960
2016-10-12 00:28:14 +00:00
Eric Fiselier 612c00df31 Make it easier to run the libc++ test suite against libstdc++
llvm-svn: 283958
2016-10-12 00:00:37 +00:00
Eric Fiselier e6364a35fd Fix LWG2683 - filesystem::copy() should always clear the user-provided error_code
llvm-svn: 283951
2016-10-11 22:18:09 +00:00
Eric Fiselier 9595fb21dd Fix std::pair on FreeBSD
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
2016-10-11 21:22:21 +00:00
Eric Fiselier e778d10c0f Fix incorrect exception handling behavior in the uninitialized algorithms
llvm-svn: 283941
2016-10-11 21:13:44 +00:00
Marshall Clow 089d54b540 Add tests to check that swap(std::function, std::function) is noexcept. This is LWG#2062, but we already do this. No changes to the library, just adding tests.
llvm-svn: 283780
2016-10-10 16:47:48 +00:00
Marshall Clow 610ad3a598 Add tests for LWG2544. We already implement this; just adding tests to make sure that we keep doing it.
llvm-svn: 283749
2016-10-10 14:10:45 +00:00
Eric Fiselier ac473034fc Provide a constexpr addressof with GCC 7.
__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
2016-10-10 05:34:18 +00:00
Eric Fiselier 054fc4cef6 Fix linker script generation for in-tree builds
llvm-svn: 283700
2016-10-09 21:34:03 +00:00
Eric Fiselier f03ffb2c9b Remove all _LIBCPP_VERSION tests from under test/std
llvm-svn: 283644
2016-10-08 01:32:56 +00:00
Eric Fiselier e58baed3a3 Purge all usages of _LIBCPP_STD_VER under test/std/algorithm
llvm-svn: 283643
2016-10-08 01:25:23 +00:00
Eric Fiselier b10fc37096 Add missing <memory> include in test
llvm-svn: 283633
2016-10-08 00:59:16 +00:00
Eric Fiselier 653179b77b Add missing include in test_allocator.h
llvm-svn: 283632
2016-10-08 00:57:56 +00:00
Eric Fiselier 69a4f66114 [libc++] Fix stack_allocator
Summary:
To quote STL the problems with stack allocator are"

>"stack_allocator<T, N> is seriously nonconformant to N4582 17.6.3.5 [allocator.requirements].
> First, it lacks a rebinding constructor. (The nested "struct rebind" isn't sufficient.)
> Second, it lacks templated equality/inequality.
> Third, it completely ignores alignment.
> Finally, and most severely, the Standard forbids its existence. Allocators are forbidden from returning memory "inside themselves". This requirement is implied by the Standard's requirements for rebinding and equality. It's permitted to return memory from a separate buffer object on the stack, though."

This patch attempts to address all of those issues.

First, instead of storing the buffer inside the allocator I've change `stack_allocator` to accept the buffer as an argument.

Second, in order to fix rebinding I changed the parameter list from `<class T, size_t NumElements>` to `<class T, size_t NumBytes>`. This allows allocator rebinding
between types that have different sizes. 

Third, I added copy and rebinding constructors and assignment operators.

And finally I fixed the allocation logic to always return properly aligned storage.



Reviewers: mclow.lists, howard.hinnant, STL_MSFT

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25154

llvm-svn: 283631
2016-10-08 00:56:22 +00:00
Eric Fiselier 609e669e1a Fix shadow warnings. Patch from STL@microsoft.com
llvm-svn: 283618
2016-10-07 22:10:35 +00:00
Eric Fiselier b18fd9654f Fix various issues in std::any and the related tests.
* 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
2016-10-07 21:27:45 +00:00
Eric Fiselier 89c9191447 Remove MSVC workarounds. Patch from STL@microsoft.com
llvm-svn: 283580
2016-10-07 18:51:33 +00:00
Asiri Rathnayake 08eb2148ff [libcxx] Recover no-exceptions XFAILs - I
First batch of changes to get some of these XFAILs working in the
no-exceptions libc++ variant.

Changed some XFAILs to UNSUPPORTED where the test is all about exception
handling. In other cases, used the test macros TEST_THROW and
TEST_HAS_NO_EXCEPTIONS to conditionally exclude those parts of the test
that concerns exception handling behaviour.

Reviewers: EricWF, mclow.lists

Differential revision: https://reviews.llvm.org/D24562

llvm-svn: 283441
2016-10-06 11:15:41 +00:00
Marshall Clow 23c725ebdf Comment out failing test while I figure out who is at fault
llvm-svn: 283360
2016-10-05 18:47:18 +00:00
Marshall Clow d836a9d5f1 Make tests for is_empty better. No functional change.
llvm-svn: 283339
2016-10-05 17:01:16 +00:00
Marshall Clow 67be6ff839 Add another append test for basic_string
llvm-svn: 283331
2016-10-05 15:47:13 +00:00
Eric Fiselier 015839a555 [libcxx] [test] Guard __has_include usage with a macro
Summary: There's a macro scheme already being used for __has_feature etc. Use it for __has_include too, which makes MSVC happy (it doesn't support __has_include yet, and unguarded use explodes horribly).

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25251

llvm-svn: 283260
2016-10-04 21:25:51 +00:00
Marshall Clow 53abcbd8a9 Add tests to make sure that is_constructible<cv-void> is false. We already checked 'unqualified void'. This was brought up by LWG#2738
llvm-svn: 283161
2016-10-03 23:39:52 +00:00
Logan Chien 45e8ba88c3 [lit] Allow more file extensions for test cases.
This commit splits the file extensions before determining the test
format.  This allows libc++abi to add assembly-based test cases.

llvm-svn: 283118
2016-10-03 16:00:22 +00:00
Eric Fiselier 2c8c71f13e Remove all instances of _LIBCPP_HAS_NO_RVALUE_REFERENCES from test/std/utilities
llvm-svn: 283032
2016-10-01 10:46:01 +00:00
Eric Fiselier f18891050b Replace test_throw.h header with a single test macro
llvm-svn: 283030
2016-10-01 10:34:13 +00:00
Eric Fiselier c24e6dd3c8 [libc++] Extension: Make `move` and `forward` constexpr in C++11.
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
2016-09-26 20:55:02 +00:00
Eric Fiselier 221f689f3b Update -verify test to use new static assert message
llvm-svn: 282352
2016-09-25 08:30:05 +00:00
Eric Fiselier 54613ab4d4 [libc++] Remove various C++03 feature test macros
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
2016-09-25 03:34:28 +00:00
Marshall Clow a8fd1e4be0 Fix a few static_asserts that need extra parens on -03
llvm-svn: 282343
2016-09-24 23:52:21 +00:00
Marshall Clow 54f0981ebd Implement proposed resolution for LWG#2758. Reviewed as D24446. Normally, I 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
2016-09-24 22:45:42 +00:00
Marshall Clow 450370f3c8 Fix incorrect include in is_error_code_enum.pass.cpp
llvm-svn: 282332
2016-09-24 18:16:53 +00:00
Marshall Clow e69a08ba6d Implement is_error_code_v and is_error_condition_v for c++17. Rework the 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
2016-09-24 17:36:14 +00:00
Marshall Clow c669522a26 Fix failure on 03 bot
llvm-svn: 282134
2016-09-22 03:25:22 +00:00
Marshall Clow a48055cee3 Add missing _v traits. is_bind_expression_v, is_placeholder_v and uses_allocator_v
llvm-svn: 282126
2016-09-22 00:23:15 +00:00
Asiri Rathnayake a6199170ac [libcxx] Add missing c++98 xfail. NFC.
This is the only test failing in c++98 mode at the moment.

llvm-svn: 281731
2016-09-16 14:32:19 +00:00
Kuba Brecka 50bc34ca31 [libcxx] Allow sanitizing libcxx with ASan+UBSan simultaneously
Allow building with LLVM_USE_SANITIZER=“Address;Undefined” (and “Undefined;Address”).

Differential Revision: https://reviews.llvm.org/D24569

llvm-svn: 281603
2016-09-15 11:04:53 +00:00
Kuba Brecka f239e6b7a2 [libcxx] Add a TSan regression test for a data race in call_once
Differential Revision: https://reviews.llvm.org/D24297

llvm-svn: 281477
2016-09-14 14:15:42 +00:00
Kuba Brecka eec85de4c0 [libcxx] Fix a typo in test/libcxx/test/target_info.py that prevents running tests on Darwin with sanitizers
Differential Revision: https://reviews.llvm.org/D24297

llvm-svn: 281476
2016-09-14 14:13:50 +00:00
Asiri Rathnayake 8c2bf45da9 [libcxx] Introduce an externally-threaded libc++ variant.
This patch further decouples libc++ from pthread, allowing libc++ to be built
against other threading systems. There are two main use cases:

- Building libc++ against a thread library other than pthreads.

- Building libc++ with an "external" thread API, allowing a separate library to
  provide the implementation of that API.

The two use cases are quite similar, the second one being sligtly more
de-coupled than the first. The cmake option LIBCXX_HAS_EXTERNAL_THREAD_API
enables both kinds of builds. One needs to place an <__external_threading>
header file containing an implementation of the "libc++ thread API" declared
in the <__threading_support> header.

For the second use case, the implementation of the libc++ thread API can
delegate to a custom "external" thread API where the implementation of this
external API is provided in a seperate library. This mechanism allows toolchain
vendors to distribute a build of libc++ with a custom thread-porting-layer API
(which is the "external" API above), platform vendors (recipients of the
toolchain/libc++) are then required to provide their implementation of this API
to be linked with (end-user) C++ programs.

Note that the second use case still requires establishing the basic types that
get passed between the external thread library and the libc++ library
(e.g. __libcpp_mutex_t). These cannot be opaque pointer types (libc++ sources
won't compile otherwise). It should also be noted that the second use case can
have a slight performance penalty; as all the thread constructs need to cross a
library boundary through an additional function call.

When the header <__external_threading> is omitted, libc++ is built with the
"libc++ thread API" (declared in <__threading_support>) as the "external" thread
API (basic types are pthread based). An implementation (pthread based) of this
API is provided in test/support/external_threads.cpp, which is built into a
separate DSO and linked in when running the libc++ test suite. A test run
therefore demonstrates the second use case (less the intermediate custom API).

Differential revision: https://reviews.llvm.org/D21968

Reviewers: bcraig, compnerd, EricWF, mclow.lists
llvm-svn: 281179
2016-09-11 21:46:40 +00:00
Eric Fiselier 94b812ac77 Avoid compile error by giving the test type a user defined default constructor
llvm-svn: 280780
2016-09-07 03:50:36 +00:00
Marshall Clow a77bb8ef34 Fix PR#30303 - no matching function for call to '__ptr_in_range'
llvm-svn: 280779
2016-09-07 03:32:06 +00:00
Eric Fiselier f8e7a54be8 Improve constexpr tests for std::any
llvm-svn: 280777
2016-09-07 02:38:48 +00:00
Eric Fiselier c1d527d3d8 Fix PR30260 - optional<const T> not working.
This patch fixes PR30260 by using a (void*) cast on the placement argument
to placement new to casts away the const. See also http://llvm.org/PR30260.

As a drive by change this patch also changes the header guard for
<experimental/optional> to _LIBCPP_EXPERIMENTAL_OPTIONAL from _LIBCPP_OPTIONAL.

llvm-svn: 280775
2016-09-07 01:56:07 +00:00
Marshall Clow 7e1a23001d Fix Bug 30240 - std::string: append(first, last) error when aliasing. Add test cases for append/insert/assign/replace while we're at it, and fix a similar bug in insert.
llvm-svn: 280643
2016-09-05 01:54:30 +00:00
Eric Fiselier 8e571b551e Apply curr_symbol.pass.cpp test fix to missed test case
llvm-svn: 280612
2016-09-04 04:09:25 +00:00
Eric Fiselier f49fe8f2b6 Fix bad locale test data when using the newest glibc
llvm-svn: 280608
2016-09-04 00:48:54 +00:00
Marshall Clow 2a837eae39 Mark test as XFAIL for C++03, rather than providing a dummy pass.
llvm-svn: 280605
2016-09-04 00:37:06 +00:00
Eric Fiselier ff94d25063 Fix PR30202 - notify_all_at_thread_exit seg faults if run from a raw pthread context.
Summary:
This patch allows threads not created using `std::thread` to use `std::notify_all_at_thread_exit` by ensuring the TL state has been initialized within `std::notify_all_at_thread_exit`.

Additionally this patch "fixes" a potential oddity in `__thread_local_pointer::reset(pointer)`, which would previously delete the old thread local data. However there should *never* be old thread local data because pthread *should* null it out on thread exit. Unfortunately it's possible that pthread failed to do this according to the spec:


> 
> Upon key creation, the value NULL shall be associated with the new key in all active threads. Upon thread creation, the value NULL shall be associated with all defined keys in the new thread.
> 
> An optional destructor function may be associated with each key value. At thread exit, if a key value has a non-NULL destructor pointer, and the thread has a non-NULL value associated with that key, the value of the key is set to NULL, and then the function pointed to is called with the previously associated value as its sole argument. The order of destructor calls is unspecified if more than one destructor exists for a thread when it exits.
> 
> If, after all the destructors have been called for all non-NULL values with associated destructors, there are still some non-NULL values with associated destructors, then the process is repeated. If, after at least {PTHREAD_DESTRUCTOR_ITERATIONS} iterations of destructor calls for outstanding non-NULL values, there are still some non-NULL values with associated destructors, implementations may stop calling destructors, or they may continue calling destructors until no non-NULL values with associated destructors exist, even though this might result in an infinite loop.

However if pthread fails to delete the value it is probably incorrect for us to do it. Destroying the value performs all of the "at thread exit" actions registered with it but we are way past "at thread exit".





Reviewers: mclow.lists, bcraig, EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D24159

llvm-svn: 280588
2016-09-03 08:07:40 +00:00
Eric Fiselier ea982ed35a Add "FLAKY_TEST" test directive to support re-running flaky tests.
Some of the mutex tests fail on machines with high load. This patch implements
the test directive "// FLAKY_TEST" which allows a test to be run 3 times
before it's considered a failure.

llvm-svn: 280050
2016-08-30 01:46:43 +00:00
Eric Fiselier 4268a742f5 Fix pair::operator=(TupleLike&&).
This assignment operator was previously broken since the SFINAE always resulted
in substitution failure. This caused assignments to turn into
copy construction + assignment.

This patch was originally committed as r279953 but was reverted due to warnings
in the test-suite. This new patch corrects those warnings.

llvm-svn: 279955
2016-08-29 01:43:41 +00:00
Eric Fiselier 67c2344174 Revert r279953 - Fix pair::operator=(TupleLike&&)
The test emits warnings causing the test-suite to fail. Since I want this
patch merged into 3.9 I'll recommit it with a clean test.

llvm-svn: 279954
2016-08-29 01:39:54 +00:00
Eric Fiselier 0678cc793a Fix pair::operator=(TupleLike&&).
This assignment operator was previously broken since the SFINAE always resulted
in substitution failure. This caused assignments to turn into
copy construction + assignment.

llvm-svn: 279953
2016-08-29 01:09:47 +00:00
Eric Fiselier e7154709e0 Implement C++17 std::sample.
This patch implements the std::sample function added to C++17 from LFTS. It
also removes the std::experimental::sample implementation which now forwards
to std::sample.

llvm-svn: 279948
2016-08-28 22:14:37 +00:00
Eric Fiselier 040411762f Mark LWG 2716 as complete - shuffle and sample disallows lvalue URNGs.
Libc++'s implementation of shuffle and sample already support lvalue and rvalue
RNG's. This patch adds tests for both categories and marks the issue as complete.

This patch also contains drive-by change for std::experimental::sample which
improves the diagnostics produced when the correct iterator categories are
not supplied.

llvm-svn: 279947
2016-08-28 21:55:00 +00:00
Eric Fiselier 2fc65041be Implement LWG 2711. Constrain path members.
llvm-svn: 279945
2016-08-28 21:26:01 +00:00
Chris Bieneman f17227a1da [CMake] Be more consistent about naming targets and components
Summary:
The point of this patch is to have a consistent convention for naming build, check and install targets so that the targets can be constructed from the project name.

This change renames a bunch of CMake components and targets from libcxx to cxx. For each renamed target I've added a convenience target that matches the old target name and depends on the new target. This will preserve function of the old targets so that the change doesn't break the world. We can evaluate if it is worth removing the extra targets later.

Reviewers: EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D23699

llvm-svn: 279675
2016-08-24 22:17:06 +00:00
Adhemerval Zanella 9704d235d0 libcxx: Fix libcxx tests on aarch64 with libunwind
Some tests uses 'long double' to/from conversions and for some targets
they are provided by compiler runtime (either compiler-rt or libgcc).
However when building libcxx with linunwinder current test configuration
at target_info.py do not include the required libraries, as:

  not llvm_unwinder:
    "-lc++" "-lm" "-lgcc_s" "-lgcc" "-lpthread" "-lc" "-lgcc_s" "-lgcc"

  llvm_unwinder
    "-lc++" "-lm" "-lpthread" "-lc" "-lunwind" "-ldl"

This causes some tests build issues with missing symbols on aarch64,
for instance, where 'long double' is a binary float with 128-bits with
mostly of internal operations being provided by software routines.

This patch changes how to define the default linker flags with libunwinder by
adding libgcc regardless.

I checked and aarch64 and x86_64 with libcxx and libunwind (with and without
LIBCXXABI_USE_LLVM_UNWINDER).

llvm-svn: 279552
2016-08-23 19:25:12 +00:00
Marshall Clow 3820ac3106 Add missing include that caused a test failure on Windows. Thanks to STL for the patch. No functional change.
llvm-svn: 279453
2016-08-22 18:45:31 +00:00
Chris Bieneman 12b134bd4b [CMake] Get libcxx building under LLVM/runtimes
Summary:
The new LLVM runtimes build directory requires some basic conventions across the runtime projects. These changes make libcxx build under the runtimes subdirectory. The general idea of the changes is that the runtimes subdirectory requires some conventions to be consistent across runtime projects.

I expect to have a few more small patches that build on this to tie up check targets and other things useful in development workflows.

Summary of changes in this patch:

* Renamed variable LLVM_CONFIG -> LLVM_CONFIG_PATH
* Renamed variable LIBCXX_BUILT_STANDALONE -> LIBCXX_STANDALONE_BUILD
* Add an include of AddLLVM in the tests subdirectory for add_lit_testsuite.

Reviewers: EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D23696

llvm-svn: 279151
2016-08-18 21:31:51 +00:00
Marshall Clow d4e8659dfc make the associative containers do the right thing for propogate_on_container_assignment. Fixes bug #29001. Tests are only for <map> right now - more complete tests will come when we revamp our allocator testing structure.
llvm-svn: 279008
2016-08-17 23:24:02 +00:00
Marshall Clow 2a10c960fa Support allocators with explicit conversion constructors. Fixes bug #29000
llvm-svn: 278904
2016-08-17 05:58:40 +00:00
Adhemerval Zanella ced7928069 libcxx: Fix path.compare.pass expected result
The expected 'filesystem::path::compare' result states that for different
path only result sign contains the information about passed arguments
(not its integer value).  This is due it uses the output of other compare
functions (basic_string_view and char_traits) without further handling and
char_traits uses memcmp for final buffer comparison.

However for GLIBC on AArch64 the code:

  int ret = memcmp ("b/a/c", "a/b/c", 1);

Results in '64' where for x86_64 it results in '1'.

This patch fixes the expected 'filesystem::path::compare' by normalizing
all the results before assert comparison.

llvm-svn: 278745
2016-08-15 21:24:50 +00:00
Eric Fiselier 5f6100260b Fix new ASAN failures
llvm-svn: 278736
2016-08-15 20:50:01 +00:00
Eric Fiselier d9ce291739 Use -O1 when testing with ASAN and MSAN to prevent Clang OOM errors.
Currently certain tests get killed when compiled with ASAN at -O0 because
they eat all of the systems memory. This doesn't happen at -O1, so enable that
to work around the issue.

llvm-svn: 278722
2016-08-15 19:37:20 +00:00
Marshall Clow 82b16766e6 Remove test for the sign of a NaN - doesn't work on MIPS, not strictly legal. Fixes bug 28936
llvm-svn: 278387
2016-08-11 18:46:24 +00:00
Saleem Abdulrasool f5b8d8249e test: relax the FS test a slight bit to be more reliable
Some filesystems track atime always.  This relaxes the test to accept either a
filesystem which does not accurately track atime or does track the atime
accurately.  This allows the test to pass on filesystems mounted with
`strictatime` on Linux or on macOS.

llvm-svn: 278357
2016-08-11 16:58:12 +00:00
Eric Fiselier f5feedfa8b Unbreak C++03 build.
llvm-svn: 278323
2016-08-11 08:15:35 +00:00
Eric Fiselier a3e11a5b15 Refactor test archetypes implementation.
llvm-svn: 278319
2016-08-11 07:04:14 +00:00
Eric Fiselier 18dd773016 Add missing REQUIRES for C++14
llvm-svn: 278311
2016-08-11 03:33:41 +00:00
Eric Fiselier 324506b9f3 [libcxx] Add std::any
Summary:
This patch adds std::any by moving/adapting <experimental/any>.

This patch also implements the std::any parts of p0032r3 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0032r3.pdf)
and LWG 2509 (http://cplusplus.github.io/LWG/lwg-defects.html#2509).

I plan to push it in a day or two if there are no comments.


Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D22733

llvm-svn: 278310
2016-08-11 03:13:11 +00:00
Eric Fiselier 45b7b44867 Implement LWG 2148: Make non-enum default hash specialization well-formed
Summary:
This patch removes the static_assert for non-enum types in the primary hash template. Instead non-enum types create a hash<T> specialization that is not constructible nor callable.

See also:
  * http://cplusplus.github.io/LWG/lwg-active.html#2543
  * https://llvm.org/bugs/show_bug.cgi?id=28917

Reviewers: mclow.lists, EricWF

Subscribers: mehdi_amini, cfe-commits

Differential Revision: https://reviews.llvm.org/D23331

llvm-svn: 278300
2016-08-10 22:45:26 +00:00
Marshall Clow 7725546a32 std:: quailfy the calls for cend/crend/cbegin/cend. Fixes bug 28927.
llvm-svn: 278282
2016-08-10 20:04:46 +00:00
Matthias Braun 852f990ecb test/hard_link_count(): Fix test on darwin
The hard link count that stat reports are different between normal hfs and the
case sensitive variant. Accept both.

llvm-svn: 278191
2016-08-10 01:02:28 +00:00
Eric Fiselier 1d711627b4 Fix copy/move constructor annotation for the uses-allocator test types.
Previously the copy/move constructors of the test types did not
properly set the arg_id to T const& or T&& respectivly.

llvm-svn: 277970
2016-08-08 02:22:41 +00:00
Hubert Tong 2fdf202493 [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctor
Summary:
The synopsis in C++11 subclause 28.8 [re.regex] has:
```
basic_regex(const charT* p, size_t len,
            flag_type f = regex_constants::ECMAScript);
```

The default argument is added to libc++ by this change.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D22702

Reapplies r277966.
Patch by Jason Liu!

llvm-svn: 277968
2016-08-07 22:26:04 +00:00
Hubert Tong faf3149df6 Revert r277966. Forgot patch attribution.
llvm-svn: 277967
2016-08-07 22:23:24 +00:00
Hubert Tong 614c406f9e [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctor
Summary:
The synopsis in C++11 subclause 28.8 [re.regex] has:
```
basic_regex(const charT* p, size_t len,
            flag_type f = regex_constants::ECMAScript);
```

The default argument is added to libc++ by this change.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D22702

llvm-svn: 277966
2016-08-07 22:18:33 +00:00
Eric Fiselier 296d9c79f5 Fix compile error due to mismatched iterator types. Patch from STL@microsoft.com
llvm-svn: 277574
2016-08-03 05:50:03 +00:00
Eric Fiselier 9b32bfb651 Fix an MSVC x64 compiler warning. Patch from STL@microsoft.com
llvm-svn: 277573
2016-08-03 05:48:09 +00:00
Eric Fiselier 7da93bb154 Silence another occurrence of MSVC's suprious unused warning. Patch from STL@microsoft.com
llvm-svn: 277572
2016-08-03 05:46:36 +00:00
Hubert Tong ac98d59802 [libcxx] basic_regex: add traits_type, string_type
Summary:
In the synopsis in C++11 subclause 28.8 [re.regex], `basic_regex` is
specified to have member typedefs `traits_type` and `string_type`. This
change adds them to libc++.

Reviewers: mclow.lists, rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D22698

Patch by Jason Liu!

llvm-svn: 277526
2016-08-02 21:34:48 +00:00
JF Bastien 8a63138ebc NFC: fix typo
llvm-svn: 277404
2016-08-01 23:34:29 +00:00
JF Bastien 0f81478c7c atomics.align: XFAIL GCC
It currently fails because GCC changed the mangling of templates, which affects std::atomic using __attribute__((vector(X))). The bot using GCC 4.9 generates the following message:

In file included from /home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/test/libcxx/atomics/atomics.align/align.pass.sh.cpp:24:0:
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic: In instantiation of 'atomic_test<T>::atomic_test() [with T = __vector(2) int]':
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/test/libcxx/atomics/atomics.align/align.pass.sh.cpp:66:3:   required from here
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: error: 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(2) int]' conflicts with a previous declaration
     __gcc_atomic_t() _NOEXCEPT = default;
     ^
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: previous declaration 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(1) int]'
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: error: 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(2) int]' conflicts with a previous declaration
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: previous declaration 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(1) int]'
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:583:5: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
/home/llvm-builder/llvm-buildslave-root/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11/llvm/projects/libcxx/include/atomic:939:5: note: synthesized method 'std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>::__gcc_atomic_t() [with _Tp = __vector(2) int]' first required here
     __atomic_base() _NOEXCEPT = default;
     ^

GCC's docs say the following about ABI version 6:
Version 6, which first appeared in G++ 4.7, corrects the promotion behavior of C++11 scoped enums and the mangling of template argument packs, const/static_cast, prefix ++ and –, and a class scope function used as a template argument.

llvm-svn: 277380
2016-08-01 20:28:13 +00:00
JF Bastien a2b1c14911 libc++: test lock-free atomic alignment
Summary:
libc++ implements std::atomic<_Tp> using __atomic_base<_Tp> with
`mutable _Atomic(_Tp) __a_`. That member must be suitably aligned on
relevant ISAs for instructions such as cmpxchg to work properly, but
this alignment isn't checked anywhere. __atomic_base's implementation
relies on _Atomic doing "the right thing" since it's under the
compiler's control, and only the compiler knows about lock-freedom and
instruction generation. This test makes sure that the compiler isn't
breaking libc++'s expectations.

I'm looking at a few odd things in the C++ standard, and will have a few
other fixes around this area in the future.

This requires building with `-DLIBCXX_HAS_ATOMIC_LIB=True`, the test
marks the dependency as REQUIRES and won't be run without.

Reviewers: cfe-commits

Subscribers: EricWF, mclow.lists

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

llvm-svn: 277368
2016-08-01 19:27:08 +00:00
Marshall Clow 19b4035f29 Implement LCM and GCD for C++17. Same code as for Library Fundamentals TS.
llvm-svn: 276751
2016-07-26 14:29:45 +00:00
Marshall Clow ab581e79aa Implement LCM and GCD for Library Fundamentals. Reviewed as https://reviews.llvm.org/D21343.
llvm-svn: 276750
2016-07-26 14:28:34 +00:00
Eric Fiselier e26aada915 Remove use of C++1z static assert in C++11 test
llvm-svn: 276608
2016-07-25 04:56:32 +00:00
Eric Fiselier 4927c29577 Implement the std::pair parts of "Improving pair and tuple". Completes N4387.
llvm-svn: 276605
2016-07-25 04:32:07 +00:00
Eric Fiselier aedcbf898b Recommit r276548 - Make pair/tuples assignment operators SFINAE properly.
I think I've solved issues with is_assignable and references to incomplete
types. The updated patch adds tests for this case.

llvm-svn: 276603
2016-07-25 02:36:42 +00:00
Eric Fiselier 79586dca74 Make std::is_assignable tolerate references to incomplete types.
llvm-svn: 276599
2016-07-25 02:08:55 +00:00
Eric Fiselier 189f88ca35 Revert r276548 - Make pair/tuples assignment operators SFINAE properly.
This is a breaking change. The SFINAE required is instantiated the second
the class is instantiated, and this can cause hard SFINAE errors
when applied to references to incomplete types. Ex.

struct IncompleteType;
extern IncompleteType it;
std::tuple<IncompleteType&> t(it); // SFINAE will blow up.

llvm-svn: 276598
2016-07-25 01:45:07 +00:00
Eric Fiselier 93b8e51ebb Make dtor_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com
llvm-svn: 276595
2016-07-25 00:50:32 +00:00
Eric Fiselier 4e91ea50a0 Don't SFINAE pair's copy assignment operator in C++03 mode.
In C++03 mode evaluating the SFINAE can cause a hard error due to
access control violations. This is a problem because the SFINAE
is evaluated as soon as the class is instantiated, and not later.

llvm-svn: 276594
2016-07-25 00:48:36 +00:00
Eric Fiselier 141b2881d7 Mark bucket_count() assertions as non-portable. Patch from STL@microsoft.com
llvm-svn: 276593
2016-07-25 00:26:41 +00:00
Eric Fiselier 249b03effb Make move_assign_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com
llvm-svn: 276591
2016-07-25 00:18:12 +00:00
Eric Fiselier 2cd516e049 Make swap_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com.
See D21820 for more information (https://reviews.llvm.org/D21820).

llvm-svn: 276590
2016-07-25 00:15:29 +00:00
Eric Fiselier b8937d6454 Work around MSVC's non-standard ABI for enums. Patch from STL@microsoft.com
llvm-svn: 276589
2016-07-25 00:02:23 +00:00
Eric Fiselier 44b4f6b85c Fix a non-standard allocator in vector tests. Patch from STL@microsoft.com
llvm-svn: 276588
2016-07-24 23:49:42 +00:00
Eric Fiselier 8c48ebd412 Fix unique_ptr.runtime tests for null inputs. Patch from STL@microsoft.com
llvm-svn: 276587
2016-07-24 23:48:26 +00:00
Eric Fiselier 1662951974 Fix portability issues in <random> tests. Patch from STL@microsoft.com
llvm-svn: 276585
2016-07-24 23:36:18 +00:00
Eric Fiselier 307e4216b2 Mark bucket() assertions as non-portable. Patch from STL@microsoft.com
llvm-svn: 276584
2016-07-24 23:34:18 +00:00
Eric Fiselier 1b3eb43252 Fix MSVC unreferenced parameter warning. Patch from STL@microsoft.com
llvm-svn: 276583
2016-07-24 23:32:48 +00:00
Eric Fiselier f950b85122 Make move_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com
llvm-svn: 276581
2016-07-24 23:19:51 +00:00
Eric Fiselier e028cd8af8 Make bucket_count() greater-equal assertions portable. Patch from STL@microsoft.com
llvm-svn: 276580
2016-07-24 23:16:37 +00:00
Eric Fiselier ee410aca06 Mark bucket_size() assertions as non-portible. Patch from STL@microsoft.com
llvm-svn: 276578
2016-07-24 23:13:36 +00:00
Eric Fiselier 19244b67bc Guard libc++ specific tests SFINAE on std::bind's call operator. Patch from STL@microsoft.com
llvm-svn: 276576
2016-07-24 23:08:21 +00:00
Eric Fiselier d9ac87570e commit test missing from r276556
llvm-svn: 276558
2016-07-24 08:16:37 +00:00
Eric Fiselier 904a5d7007 Make pair/tuples assignment operators SFINAE properly.
llvm-svn: 276548
2016-07-24 05:51:11 +00:00
Eric Fiselier 2e99ae4f97 Fix memory leak in test.
llvm-svn: 276547
2016-07-24 04:41:44 +00:00
Eric Fiselier 790df14543 Implement LWG 2393. Check for LValue-callability.
llvm-svn: 276546
2016-07-24 04:16:40 +00:00
Eric Fiselier 63c69ef49c Implement LWG2328. Rvalue stream extraction should perfect forward.
llvm-svn: 276545
2016-07-24 04:07:22 +00:00
Eric Fiselier e4d9c316d2 Implement P0040r3: Extending memory management tools
llvm-svn: 276544
2016-07-24 03:51:39 +00:00
Eric Fiselier 58ad17df0f Implement the in_place tags from p0032r3.
That paper also has changes to any/optional but those will
be implemented later.

llvm-svn: 276537
2016-07-23 22:19:19 +00:00
Eric Fiselier 40492ba417 Fix undefined behavior in __hash_table
Summary:
This patch attempts to fix the undefined behavior in __hash_table by changing the node pointer types used throughout. The pointer types are changed for raw pointers in the current ABI and for fancy pointers in ABI V2 (since the fancy pointer types may not be ABI compatible).

The UB in `__hash_table` arises because tree downcasts the embedded end node and then deferences that pointer. Currently there are 2 node types in __hash_table:

* `__hash_node_base` which contains the `__next_` pointer.
* `__hash_node` which contains `__hash_` and `__value_`.

Currently the bucket list, iterators, and `__next_` pointers store pointers to `__hash_node` even though they all need to store `__hash_node_base` pointers.
This patch makes that change by introducing a `__next_pointer` typedef which is a pointer to `__hash_node` in the current ABI and `__hash_node_base` afterwards.

One notable change is to the type of `__bucket_list` which used to be defined as `unique_ptr<__node_pointer[], ...>` and is now `unique_ptr<__next_pointer[], ...>` meaning that we now allocate and deallocate different types using a different allocator. I'm going to give this part of the change more thought since it may introduce compatibility issues.

This change is similar to D20786.



Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D20787

llvm-svn: 276533
2016-07-23 20:36:55 +00:00
Eric Fiselier 0fdab5eb69 Implement P0392r0. Integrate filesystem::path and string_view.
llvm-svn: 276511
2016-07-23 03:10:56 +00:00
Eric Fiselier 6f4a165e51 Revert r276506 - Diagnose invalid memory order arguments in <atomic>.
There is a bug in Clang 3.6 and earlier that causes compile failures.
I suspect it's due to the usage of member function parameter names in the
attributes.

llvm-svn: 276507
2016-07-23 01:43:53 +00:00
Eric Fiselier 586b16e16a [libcxx] Diagnose invalid memory order arguments in <atomic>. Fixes PR21179.
Summary:
This patch uses the __attribute__((enable_if)) hack suggested by @rsmith to diagnose invalid arguments when possible.

In order to diagnose an invalid argument `m` to `f(m)` we provide an additional overload of `f` that is only enabled when `m` is invalid. When that function is enabled it uses __attribute__((unavailable)) to produce a diagnostic message.

Reviewers: mclow.lists, rsmith, jfb, EricWF

Subscribers: bcraig, jfb, rsmith, cfe-commits

Differential Revision: https://reviews.llvm.org/D22557

llvm-svn: 276506
2016-07-23 01:16:55 +00:00
Marshall Clow f067d20c6d Again, w/o the tabs
llvm-svn: 276273
2016-07-21 13:19:36 +00:00
Marshall Clow ef68f26b28 Another fix to appease the no-exception bots.
llvm-svn: 276272
2016-07-21 13:18:50 +00:00
Marshall Clow 187db16996 Fix some string_view tests that were failing when exceptions were disabled. Also comment out a _LIBCPP_ASSERT that gcc4.9 was complaining about. Will revisit that later.
llvm-svn: 276241
2016-07-21 06:24:04 +00:00
Marshall Clow 053d81ceeb Implement std::string_view as described in http://wg21.link/P0254R1. Reviewed as https://reviews.llvm.org/D21459
llvm-svn: 276238
2016-07-21 05:31:24 +00:00
Eric Fiselier 0e411641a3 Implement P0084r2. Changing emplace return types.
llvm-svn: 276230
2016-07-21 03:20:17 +00:00
Eric Fiselier 192c4f1a4a Disable warning flags when running .fail.cpp tests.
Increasingly the .fail.cpp tests are written using -verify, making them
sensitive to the exact diagnostics generated by the compiler. To prevent
additional diagnostics from being generated, and causing the tests to fail,
this patch removes the warning flags when compiling those tests.

llvm-svn: 276208
2016-07-20 23:37:28 +00:00
Eric Fiselier 7f1b098ab4 Unbreak traits tests by handling differences between version macros in clang/apple-clang.
llvm-svn: 276200
2016-07-20 22:53:21 +00:00
Eric Fiselier b2e7cc6994 Fix inheriting constructor test for std::function.
The test I originally checked in only worked with ToT Clang. This patch
updates the test so that it works as far back as 3.5.

llvm-svn: 276093
2016-07-20 06:46:22 +00:00
Eric Fiselier 85acffa676 Unbreak is_constructible tests for Clang <= 3.7.
There is a bug in Clang's __is_constructible builtin that causes it
to return true for function types; ex [T = void()].

llvm-svn: 276092
2016-07-20 06:36:11 +00:00
Eric Fiselier d5b5359802 Add missed test in r276090.
llvm-svn: 276091
2016-07-20 05:22:35 +00:00
Eric Fiselier b66b621038 Reimplement is_constructible fallback implementation. Fixes PR21574.
The previous implementation relied highly on specializations to handle
special cases. This new implementation lets the compiler do the work when possible.

llvm-svn: 276084
2016-07-20 05:01:24 +00:00
Eric Fiselier 074f8d7777 Add tests for reference binding assertions in std::tuple.
Libc++ provides static assertions to detect reference binding issues inside
tuple. This patch adds tests for those diagnostics.

It should be noted that these static assertions technically violate the
standard since it allows these illegal bindings to occur.

Also see https://llvm.org/bugs/show_bug.cgi?id=20855

llvm-svn: 276078
2016-07-20 02:57:39 +00:00
Eric Fiselier b11642bf94 Add SFINAE on additional overloads of std::complex functions. Fixes PR19921.
The functions arg, conj, imag, norm, proj, and real have additional overloads
for arguments of integral or floating point types. However these overloads should
not allow conversions to the integral/floating point types, only exact matches.

This patch constrains these functions so they no longer allow conversions.

llvm-svn: 276067
2016-07-20 00:14:10 +00:00
Eric Fiselier 331d21599d Add heterogeneous comparator support for __debug_less. Fixes PR17147.
llvm-svn: 276059
2016-07-19 23:27:18 +00:00
Eric Fiselier d05b10ab4f Fix undefined behavior in __tree
Summary:
This patch attempts to fix the undefined behavior in __tree by changing the node pointer types used throughout. The pointer types are changed for raw pointers in the current ABI and for fancy pointers in ABI V2 (since the fancy pointer types may not be ABI compatible).

The UB in `__tree` arises because tree downcasts the embedded end node and then deferences that pointer. Currently there are 3 node types in __tree.

* `__tree_end_node` which contains the `__left_` pointer. This node is embedded within the container.
* `__tree_node_base` which contains `__right_`, `__parent_` and `__is_black`. This node is used throughout the tree rebalancing algorithms.
* `__tree_node` which contains `__value_`.

Currently `__tree` stores the start of the tree, `__begin_node_`, as a pointer to a `__tree_node`. Additionally the iterators store their position as a pointer to a `__tree_node`. In both of these cases the pointee can be the end node. This is fixed by changing them to store `__tree_end_node` pointers instead.

To make this change I introduced an `__iter_pointer` typedef which is defined to be a pointer to either `__tree_end_node` in the new ABI or `__tree_node` in the current one.
Both `__tree::__begin_node_` and iterator pointers are now stored as `__iter_pointers`.

The other situation where `__tree_end_node` is stored as the wrong type is in `__tree_node_base::__parent_`.  Currently `__left_`, `__right_`, and `__parent_` are all `__tree_node_base` pointers. Since the end node will only be stored in `__parent_` the fix is to change `__parent_` to be a pointer to `__tree_end_node`.

To make this change I introduced a `__parent_pointer` typedef which is defined to be a pointer to either `__tree_end_node` in the new ABI or `__tree_node_base` in the current one.

Note that in the new ABI `__iter_pointer` and `__parent_pointer` are the same type (but not in the old one). The confusion between these two types is unfortunate but it was the best solution I could come up with that maintains the ABI.

The typedef changes force a ton of explicit type casts to correct pointer types and to make current code compatible with both the old and new pointer typedefs. This is the bulk of the change and it's really messy. Unfortunately I don't know how to avoid it.

Please let me know what you think.





Reviewers: howard.hinnant, mclow.lists

Subscribers: howard.hinnant, bbannier, cfe-commits

Differential Revision: https://reviews.llvm.org/D20786

llvm-svn: 276003
2016-07-19 17:56:20 +00:00
Eric Fiselier 197228927a Remove locale tests that depend on enviroment variables.
Constructing a std::locale object from an empty string selects the language
from the current environment variables. If the environment variables name
a locale that doesn't exist, or isn't installed, then the construction of
facets using that locale may throw.

This patch removes tests that use 'std::locale l("")'.

The optimal solution would be to manually set the environment variables
in the test. Unfortunately there is no portable way to do this.

llvm-svn: 275772
2016-07-18 06:15:55 +00:00
Jonas Hahnfeld 16be8ee1ff [libcxx][filesystem] Remove setgid from parent before testing permissions
man page for mkdir says: "If the parent directory has the set-group-ID bit set,
then so will the newly created directory."

Differential Revision: https://reviews.llvm.org/D22265

llvm-svn: 275760
2016-07-18 06:06:50 +00:00
Eric Fiselier a23470efe7 Rework libatomic handling in CMake and LIT.
This patch updates the way libc++ handles checking for libatomic, in part
to prepare for https://reviews.llvm.org/D22073.

Changes:
* 'LIBCXX_HAS_ATOMIC_LIB' is now set whenever libatomic is available even libc++
   doesn't need to manually link it.
* 'LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB' is now used to detect when libatomic
   needs to be manually linked.
* 'LIBCXX_HAS_ATOMIC_LIB' now adds 'libatomic' as a available feature in the
   test suite.

llvm-svn: 275759
2016-07-18 06:01:50 +00:00
Eric Fiselier 826f17399b Improve ABI tests for std::pair.
llvm-svn: 275757
2016-07-18 04:48:37 +00:00
Eric Fiselier fb946da259 Add checkpoint diagnostics to help diagnose buildbot failures.
llvm-svn: 275754
2016-07-18 03:00:09 +00:00
Eric Fiselier 03f46fc2ed Prevent failures by marking Clock::is_steady tests as UNSUPPORTED: asan.
llvm-svn: 275753
2016-07-18 02:29:33 +00:00
Eric Fiselier ec0a4c9946 Add includes in test. Patch from STL@microsoft.com
llvm-svn: 275751
2016-07-18 02:05:31 +00:00
Eric Fiselier 35b6413d1b Rename and rework `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR`. Move FreeBSD configuration in-tree.
This patch does the following:

* It renames `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR` to `_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR`.
* It automatically enables this option on FreeBSD in ABI V1, since that's the current ABI FreeBSD ships.
* It cleans up the handling of this option in `std::pair`.

I would like the sign off from the FreeBSD maintainers. They will no longer need to keep their `__config` changes downstream.

I'm still hoping to come up with a better way to maintain the ABI without needing these constructors.

Reviewed in https://reviews.llvm.org/D21329

llvm-svn: 275749
2016-07-18 01:58:37 +00:00
Eric Fiselier 1447da3383 Suppress warning in make_from_tuple tests.
llvm-svn: 275748
2016-07-18 01:52:46 +00:00
Eric Fiselier 03e29a2964 Implement C++17 tuple bits. Including apply and make_from_tuple.
This patch upgrades <tuple> to be C++17 compliant by implementing:

* tuple_size_v: This was forgotten when implementing the other _v traits.
* std::apply: This was added via LFTS v1 in p0220r1.
* std::make_from_tuple: This was added in p0209r2.

llvm-svn: 275745
2016-07-18 00:35:56 +00:00
Eric Fiselier 649da70def Fix std::experimental::optional tests. Patch from Casey Carter.
llvm-svn: 275732
2016-07-17 20:32:30 +00:00
Marshall Clow 10e8bef1d4 Add more tests for LWG#2582. No code changes needed, just tests.
llvm-svn: 275211
2016-07-12 20:15:46 +00:00
JF Bastien 5868e5dde9 libc++: name anonymous structs
As discussed in http://reviews.llvm.org/D22073

llvm-svn: 275210
2016-07-12 20:14:52 +00:00
Marshall Clow 8001ccd06e Add tests for the meta.unary.props that do not require a complete type. This is part of LWG#2582
llvm-svn: 275184
2016-07-12 15:50:53 +00:00
Marshall Clow dc3eb83d08 Always use the allocator to construct/destruct elements of a deque/vector. Fixes PR#28412. Thanks to Jonathan Wakely for the report.
llvm-svn: 275105
2016-07-11 21:38:08 +00:00
Eric Fiselier 0774aa96dc Allow is_swappable to SFINAE on deleted/ambiguous swap functions
llvm-svn: 275094
2016-07-11 19:57:13 +00:00
Marshall Clow bc3b1f3b7b Fix typo in #ifdef; leave tests commented out b/c gcc 4.8 harks on them.
llvm-svn: 274882
2016-07-08 16:59:54 +00:00
Manman Ren 78fa242ec2 Revert r274605 due to bot failure: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/244/
llvm-svn: 274651
2016-07-06 18:24:53 +00:00
Marshall Clow 5c29783bf2 Fix typo in #ifdef, and re-enable tests now that the green-dragon bots are no more
llvm-svn: 274605
2016-07-06 05:28:44 +00:00
Eric Fiselier 4f905b8daa Handle std::get<T>(...) for std::tuple<>
llvm-svn: 274422
2016-07-02 03:46:08 +00:00
Eric Fiselier f447e62e1d Rewrite std::get<Type>(...) helper using constexpr functions.
llvm-svn: 274418
2016-07-02 03:18:30 +00:00
Eric Fiselier 27cdf401ea Cleanup SFINAE in tuple, and add tests for reference assignment
llvm-svn: 274414
2016-07-02 01:25:46 +00:00
Eric Fiselier 7b60958aea Make tuple_constructible and family lazy again.
llvm-svn: 274413
2016-07-02 00:58:17 +00:00
Eric Fiselier 58b6e3e3d0 Turn off ASAN's odr-violation diagnostics for now. See PR28391
llvm-svn: 274404
2016-07-01 23:25:47 +00:00
Eric Fiselier 10b9a1bb42 Flatten the tuple_element and __make_tuple_types implementations.
This patch attempts to improve the QoI of std::tuples tuple_element and
__make_tuple_types helpers. Previously they required O(N) instantiations,
one for every element in the tuple

The new implementations are O(1) after __tuple_indices<Id...> is created.

llvm-svn: 274330
2016-07-01 03:54:54 +00:00
Marshall Clow 3b8669edbf Fix static assert problem on gcc; remove XFAILs that I put in in r274250
llvm-svn: 274285
2016-06-30 22:05:45 +00:00
Eric Fiselier 19cf6b6c93 Fix C++03 build.
llvm-svn: 274274
2016-06-30 20:46:58 +00:00
Marshall Clow e46c0885ff Implement LWG#2688: 'clamp misses preconditions and has extraneous condition on result'. We already did this, just added tests
llvm-svn: 274252
2016-06-30 17:52:51 +00:00
Marshall Clow bc4618647f Temporarily XFAIL the incomplete type tests for GCC while I figure out why adding a static_assert in r274235 broken them
llvm-svn: 274250
2016-06-30 17:49:36 +00:00
Marshall Clow c8afc869b0 Implement LWG#2684: 'priority_queue lacking comparator typedef'. We already did this, just added tests
llvm-svn: 274243
2016-06-30 16:03:50 +00:00
Marshall Clow 81fce9729c Implement LWG#2596: 'vector::data() should use addressof'
llvm-svn: 274241
2016-06-30 15:50:55 +00:00
Marshall Clow e766a87b01 Implement LWG#2441: 'Exact-width atomic typedefs should be provided'
llvm-svn: 274236
2016-06-30 15:28:38 +00:00
Marshall Clow 497677449b Implement LWG#2436: 'Comparators for associative containers should always be CopyConstructible'
llvm-svn: 274235
2016-06-30 15:11:53 +00:00
Eric Fiselier d3c2acd38c Make futures.overview enum tests more portable. Patch from STL@microsoft.com
llvm-svn: 274211
2016-06-30 05:00:32 +00:00
Eric Fiselier b21f96ac4b Make std::array typedef tests more portable.
llvm-svn: 274210
2016-06-30 04:54:00 +00:00
Eric Fiselier 8892b4eef0 Fix ::reference typedef in insert iterators.
Since at least the C++11 standard insert iterators are specified
as having ::reference typedef void. Libc++ was not doing that.
This patch corrects the typedef.

This patch changes the std::iterator base class of insert_iterator,
front_insert_iterator and back_insert_iterator. This should not
be an ABI breaking change.

llvm-svn: 274209
2016-06-30 04:40:50 +00:00
Eric Fiselier cb1fd66853 Make instreambuf.iterator/types.pass.cpp more portable.
llvm-svn: 274207
2016-06-30 04:31:09 +00:00
Eric Fiselier c76111a132 Fix use of terse static assert. Patch from STL@microsoft.com
llvm-svn: 274206
2016-06-30 04:29:12 +00:00
Eric Fiselier 3b0184321f Fix unary_function inheritance assumption. Patch from STL@microsoft.com
llvm-svn: 274205
2016-06-30 04:28:12 +00:00
Eric Fiselier 2bbb125d4e Fix unreferenced parameter warning. Patch from STL@microsoft.com
llvm-svn: 274204
2016-06-30 04:22:58 +00:00
Eric Fiselier 2afa66e124 Avoid applying unary minus to unsigned integers. Patch from STL@microsoft.com
llvm-svn: 274203
2016-06-30 04:21:52 +00:00
Akira Hatanaka 2556b769ec [libcxx] Fix a bug in strstreambuf::overflow.
The end pointer should point to one past the end of the newly allocated
buffer.

rdar://problem/24265174

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

llvm-svn: 274132
2016-06-29 15:26:13 +00:00
Eric Fiselier e3c72c1c85 Fix UB in uses_alloc_types.hpp
llvm-svn: 273840
2016-06-27 01:52:14 +00:00
Eric Fiselier 68436a9b48 Implement P0163r0. Add shared_ptr::weak_type.
This patch adds the weak_type typedef in shared_ptr. It is available in
C++17 and newer.

This patch also updates the _LIBCPP_STD_VER and TEST_STD_VER macros to
have the value of 16, since 2016 is the current year.

llvm-svn: 273839
2016-06-27 01:02:43 +00:00
Eric Fiselier 8b7faa6871 Implement p0337r0. Delete operator= for polymorphic_allocator.
llvm-svn: 273838
2016-06-27 00:55:25 +00:00
Eric Fiselier 9372d8bc61 Implement P0358r1. Fixes for not_fn.
llvm-svn: 273837
2016-06-27 00:40:41 +00:00
Eric Fiselier 06e9017d7b Fix C++03 failure in enable_shared_from_this test
llvm-svn: 273836
2016-06-27 00:38:28 +00:00
Eric Fiselier 39005d3019 Fix PR27115 - enable_shared_from_this does not work as a virtual base class.
See https://llvm.org/bugs/show_bug.cgi?id=27115

The problem was that the conversion from
'const enable_shared_from_this<T>*' to 'const T*' didn't work if
T inherited enable_shared_from_this as a virtual base class. The fix
is to take the original pointer passed to shared_ptr's constructor in the
__enable_weak_this method and perform an upcast to 'const T*' instead of
performing a downcast from the enable_shared_from_this base.

llvm-svn: 273835
2016-06-26 23:56:32 +00:00
Eric Fiselier 66fe5a4e2b Fix C++03 build
llvm-svn: 273832
2016-06-26 23:18:23 +00:00
Eric Fiselier bb94dca13a Fix PR28079 - std::wstring_convert move constructor broken.
The move constructor for wstring_convert accidentally copied the state member
into the converted count member in the move constructor. This patch fixes
the typo.

While working on this I discovered that wstring_convert doesn't actually
provide a move constructor according to the standard and therefore this
constructor is a libc++ extension. I'll look further into whether libc++ should
provide this constructor at all. Neither libstdc++ or MSVC's STL provide it.

llvm-svn: 273831
2016-06-26 22:56:26 +00:00
Eric Fiselier 555330719a Implement LWG 2488 - Make the placeholders constexpr.
This patch makes the bind placeholders in std::placeholders both (1) const and
(2) constexpr (See below).

This is technically a breaking change for any code using the placeholders
outside of std::bind and depending on them being non-const. However I don't
think this will break any real world code.

(1) Previously the placeholders were non-const extern globals in all
dialects. This patch changes these extern globals to be const in all dialects.
Since the cv-qualifiers don't participate in name mangling for globals this
is an ABI compatible change.

(2) Make the placeholders constexpr in C++11 and beyond. Although LWG 2488 only
applies to C++17 I don't see any reason not to backport this change.

llvm-svn: 273824
2016-06-26 21:01:34 +00:00
Eric Fiselier a9fb19d3a5 Make default_noexcept.pass.cpp container tests more portable. Patch from STL@microsoft.com
llvm-svn: 273823
2016-06-26 20:21:22 +00:00