Commit Graph

81 Commits

Author SHA1 Message Date
Eric Fiselier
8eb066a106 Replace _LIBCPP_HAS_NO_DELETED_FUNCTIONS with _LIBCPP_CXX03_LANG
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291278 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06 20:58:25 +00:00
Eric Fiselier
c3dfeced41 Fix PR26961 - Add default constructor to std::pointer_safety struct.
In ABI v1 libc++ implements std::pointer_safety as a class type instead
of an enumeration. However this class type does not provide
a default constructor as it should. This patch adds that default constructor.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291059 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 01:28:40 +00:00
Eric Fiselier
46a0c2ef0c Fix std::pointer_safety type in ABI v2
In the C++ standard `std::pointer_safety` is defined
as a C++11 strongly typed enum. However libc++ currently defines
it as a class type which simulates a C++11 enumeration. This
can be detected in valid C++ code.

This patch introduces an the _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE ABI option.
When defined `std::pointer_safety` is implemented as an enum type.
Unfortunatly this also means it can no longer be provided as an extension
in C++03.

Additionally this patch moves the definition for `get_pointer_safety()`
out of the dylib, and into the headers. New usages of `get_pointer_safety()`
will now use the inline version instead of the dylib version. However in
order to keep the dylib ABI compatible the old definition is explicitly
compiled into it.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291046 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 01:15:42 +00:00
Eric Fiselier
0e5ebbc77c Fix unused parameters and variables
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:37:52 +00:00
Roger Ferrer Ibanez
01b9f8a698 Protect tests for std::uninitialized_{copy,fill} under libcpp-no-exceptions
Skip tests that expect an exception be thrown.

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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287866 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 11:17:09 +00:00
Stephan T. Lavavej
cb9d881ca0 [libcxx] [test] D26813: allocator<const T> is non-Standard.
N4582 17.6.3.5 [allocator.requirements] says that allocators are given
cv-unqualified object types, and N4582 20.9.9 [default.allocator]
implies that allocator<const T> is ill-formed (due to colliding
address() overloads). Therefore, tests for allocator<const T>
should be marked as libcxx-specific (if not removed outright).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287381 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 21:54:31 +00:00
Marshall Clow
7817e1435e Make one of the new tests fail correctly on pre-C++17 systems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286872 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 19:35:34 +00:00
Marshall Clow
db7fa111ab Fixes for LWG 2598, 2686, 2739, 2742, 2747, and 2759, which were adopted last week in Issaquah
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286858 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 18:22:19 +00:00
Roger Ferrer Ibanez
d56adc690b Protect smart-pointer tests under no exceptions
Skip tests that expect an exception be thrown under no-exceptions.

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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286809 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 10:27:56 +00:00
Stephan T. Lavavej
e619862dbf [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.
This replaces every occurrence of _LIBCPP_STD_VER in the tests with
TEST_STD_VER. Additionally, for every affected
file, #include "test_macros.h" is being added explicitly if it wasn't
already there.

https://reviews.llvm.org/D26294

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286007 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-04 20:26:59 +00:00
Roger Ferrer Ibanez
efc9f170c9 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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285550 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-31 08:47:53 +00:00
Eric Fiselier
05577c82e1 Fix incorrect exception handling behavior in the uninitialized algorithms
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283941 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 21:13:44 +00:00
Eric Fiselier
a244bb9d18 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283715 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-10 05:34:18 +00:00
Eric Fiselier
89e826a160 Remove all instances of _LIBCPP_HAS_NO_RVALUE_REFERENCES from test/std/utilities
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283032 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 10:46:01 +00:00
Eric Fiselier
cdac787ae8 Replace test_throw.h header with a single test macro
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283030 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 10:34:13 +00:00
Eric Fiselier
4e3e15ad99 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282347 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-25 03:34:28 +00:00
Marshall Clow
45d7731bbb Fix failure on 03 bot
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282134 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 03:25:22 +00:00
Marshall Clow
2fffe3a6ff Add missing _v traits. is_bind_expression_v, is_placeholder_v and uses_allocator_v
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282126 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 00:23:15 +00:00
Eric Fiselier
60c8accd6e Fix an MSVC x64 compiler warning. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277573 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 05:48:09 +00:00
Eric Fiselier
4218032e70 Fix unique_ptr.runtime tests for null inputs. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276587 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 23:48:26 +00:00
Eric Fiselier
678bf67dcf Fix memory leak in test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276547 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 04:41:44 +00:00
Eric Fiselier
c672a7453d Implement P0040r3: Extending memory management tools
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276544 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 03:51:39 +00:00
Eric Fiselier
83d7ca9ea5 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273839 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-27 01:02:43 +00:00
Eric Fiselier
c297a25c55 Fix C++03 failure in enable_shared_from_this test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273836 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-27 00:38:28 +00:00
Eric Fiselier
7838768593 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273835 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-26 23:56:32 +00:00
Eric Fiselier
d61ea34a58 Make shared_ptr constructor tests use count_new.hpp
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273379 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 04:51:07 +00:00
Eric Fiselier
604b5c48ec Don't use non-conforming pointer_traits specialization it tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273368 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 02:31:32 +00:00
Eric Fiselier
22bff1afcc Move remaining _LIBCPP_VERSION tests into test/libcxx
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273367 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 02:23:22 +00:00
Eric Fiselier
d24c465bea Replace __cplusplus comparisons and dialect __has_feature checks with TEST_STD_VER.
This is a huge cleanup that helps make the libc++ test suite more portable.
Patch from STL@microsoft.com. Thanks STL!


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 21:31:42 +00:00
Eric Fiselier
b36940bb34 Fix leak in __enable_weak_this(). Thanks to Arthur O'Dwyer for finding it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271487 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 04:57:00 +00:00
Eric Fiselier
dbfa5b6ea7 Remove enable_shared_from_this test since it leaks the control block and fails with ASAN
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 01:09:12 +00:00
Eric Fiselier
18e1ea69ae Implement P0033R1 - Re-enabling shared_from_this
Summary: See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0033r1.html

Reviewers: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271449 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 00:15:35 +00:00
Eric Fiselier
84acb1ec3f Remove trailing whitespace in test suite. Approved by Marshall Clow.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 21:35:39 +00:00
Eric Fiselier
8a8c114479 Mark LWG issue 2520 as complete
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271249 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 04:27:57 +00:00
Asiri Rathnayake
a3eac518e6 [libcxx] Improve tests to use the UNSUPPORTED lit directive
Quite a few libcxx tests seem to follow the format:
 #if _LIBCPP_STD_VER > X
   // Do test.
 #else
   // Empty test.
 #endif
We should instead use the UNSUPPORTED lit directive to exclude the test on
earlier C++ standards. This gives us a more accurate number of test passes
for those standards and avoids unnecessary conflicts with other lit
directives on the same tests.

Reviewers: bcraig, ericwf, mclow.lists

Differential revision: http://reviews.llvm.org/D20730

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271108 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-28 08:57:35 +00:00
Marshall Clow
5d98497d0b Add a test for uniqueptr having either NULL and nullptr
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@269665 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 16:57:15 +00:00
Marshall Clow
aee206a3a1 Apply D20014 - fix a missing return in a test. Fixes PR#27720
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@269298 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 14:31:35 +00:00
Eric Fiselier
4db388b579 Change allocator<T>::allocate to throw length_error, not bad_alloc
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@268842 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07 03:12:24 +00:00
Eric Fiselier
a9ea11398d Void cast runtime-unused variables. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@268284 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 19:15:48 +00:00
Eric Fiselier
849c551745 Add braces, move braces, and rename variables to avoid shadowing. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267844 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 02:45:11 +00:00
Marshall Clow
d7f1f971d1 Rename a few tests that had typos in their names. No functional change. Thanks to STL for the catch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267287 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 14:31:00 +00:00
Eric Fiselier
8f1e73dfd2 Add is_swappable/is_nothrow_swappable traits
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267079 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21 23:38:59 +00:00
Eric Fiselier
8d5cbd7ce2 Add 'is_callable' and 'is_nothrow_callable' traits and cleanup INVOKE.
The primary purpose of this patch is to add the 'is_callable' traits.
Since 'is_nothrow_callable' required making 'INVOKE' conditionally noexcept
I also took this oppertunity to implement a constexpr version of INVOKE.
This fixes 'std::experimental::apply' which required constexpr 'INVOKE support'.

This patch will be followed up with some cleanup. Primarly removing most
of "__member_function_traits" since it's no longer used by INVOKE (in C++11 at least).


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266836 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-20 00:14:32 +00:00
Eric Fiselier
c325f3dccf Add tests for LWG issue 2361
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 02:31:05 +00:00
Eric Fiselier
735026e3ee Make std::addressof constexpr in C++17 (Clang only).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@263688 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-17 03:30:56 +00:00
Marshall Clow
d8b9e0bbff Mark exception-throwing test as XFAIL when exceptions are disabled
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@263405 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-14 02:51:50 +00:00
Marshall Clow
4951a48a6a Fix for PR26812: possible overflow issue in std::allocator::allocate
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@262610 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 12:04:39 +00:00
Marshall Clow
17a80bc8b6 No, really - test the constructor
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@261875 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 15:27:13 +00:00
Marshall Clow
5425ba06f6 Add test to ensure that the converting constructor in N4089 is present and working
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@261874 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 15:25:29 +00:00
Marshall Clow
3f159e874c Implement P0074: Making owner_less more flexible
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@252905 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 15:56:44 +00:00