Commit Graph

3918 Commits

Author SHA1 Message Date
Eric Fiselier
98d9a858da Implement LWG 2857 for variant. Tests from Casey Carter @ Microsoft.
Also mark LWG 2857 as complete, since the changes to optional and
any were completed by Marshall earlier.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300403 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-15 19:32:02 +00:00
Eric Fiselier
6ad335bfc0 Simplify test helper
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300399 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-15 12:05:11 +00:00
Eric Fiselier
622c7d5846 Fix PR32642 - string::insert and string::append don't work with move_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300397 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-15 06:49:02 +00:00
Eric Fiselier
9ea4041df8 [libcxx] Fix check-cxx-abilist on OS X
Summary:
Recent commits broke the check-cxx-abilist by changing the default OS X to use `-rexport_library` instead of `-reexport_symbol_list`. Apparently `-reexport_library` doesn't export the symbols into `libc++.dylib`s symbol table, whereas `-reexport_symbol_list` does.

This means the change removed ~500 symbols from the symbol table. I've been told this change is non ABI breaking, but it does make it harder to maintain the ABI lists, and hence the ABI.

This patch fixes the issue by switching back to `-reexport_symbol_list`. It still avoid the issues fixed in r299052 by putting the new/delete symbols in a different symbol list file, which is only exported when LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS in OFF.


Reviewers: mehdi_amini, smeenai, dexonsmith

Reviewed By: smeenai

Subscribers: mgorny, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300390 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-15 05:41:45 +00:00
Eric Fiselier
81f58e5052 Rewrite and cleanup unique_ptr tests.
This patch almost entirely rewrites the unique_ptr tests. There are a couple
of reasons for this:

A) Most of the *.fail.cpp tests were either incorrect or could be better written
  as a *.pass.cpp test that uses <type_traits> to check if certain operations
  are valid (Ex. Using static_assert(!std::is_copy_constructible_v<T>) instead
  of writing a failure test).

B) [unique.ptr.runtime] has very poor test coverage. Many of the constructors
  and assignment operators have to tests at all. The special members that have
  tests have very few test cases and are typically way out of date.

C) The tests for [unique.ptr.single] and [unique.ptr.runtime] are largely
  duplicates of each other. This means common requirements have two different
  sets of tests in two different test files. This makes the tests harder to
  maintain than if there was a single copy.

To address (A) this patch changes almost all of the *.fail.cpp tests into
.pass.cpp tests using type traits; Allowing the *.fail.cpp tests to be removed.

The address (B) and (C) the tests for [unique.ptr.single] and [unique.ptr.runtime]
have been combined into a single directory, allowing both specializations to share
common tests. Tests specific to the single/runtime specializations are given the
suffix "*.single.pass.cpp" or "*.runtime.pass.cpp".

Finally the unique.ptr test have been moved into the correct directory according
to the standard. Specifically they have been removed from "utilities/memory" into
"utilities/smartptr".

PS. This patch also adds newly written tests for upcoming unique_ptr changes/fixes.
However since these tests don't currently pass they are guarded by the macro
TEST_WORKAROUND_UPCOMING_UNIQUE_PTR_CHANGES. This allows other STL's to validate
the tests before libc++ implements the changes. The relevant libc++ changes should
land in the next week.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300388 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-15 05:28:06 +00:00
Eric Fiselier
dfac40a8fc Make clang-format use C++03 syntax
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300387 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-15 02:45:43 +00:00
Petr Hosek
82a50d6474 [libcxx] Direct support for Fuchsia
Fuchsia's libc was forked from musl, but has evolved sufficiently
since then so it no longer makes sense to pretend it's musl. This
change implements direct support for Fuchsia rather than
piggybacking on musl support.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300261 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 21:29:21 +00:00
Shoaib Meenai
e1c9dfba1a [libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config option
When the libc++ extern template macros were added, the intent was for it
to be possible for consumers of the headers to disable extern templates
(via `-D_LIBCPP_EXTERN_TEMPLATE(...)=`). Unfortunately, support for
specifying function-like macros varies on the command line varies across
compilers (e.g. MSVC doesn't support it at all), and cmake doesn't allow
it for the same reason. Add a non-function macro for this purpose.

The intended use is for libraries which want to use the libc++ headers
without taking a dependency on the libc++ library itself. I can name the
macro something which reflects its intent rather than its behavior (e.g.
`_LIBCPP_HEADER_ONLY`) if desired.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300246 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 20:13:32 +00:00
Marshall Clow
059256914c Remove the binders from C++17. Reviewed as https://reviews.llvm.org/D31769
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300232 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 18:25:32 +00:00
Marshall Clow
6403571b40 Implement LWG#2855 - made easy by previous refactoring
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300218 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 16:57:42 +00:00
Shoaib Meenai
b975b451af [libc++] Explicitly set output directory for DLL
DLLs on Windows are treated as runtime targets. Explicitly set the
output directory for them, to be consistent with other platforms.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300206 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 16:27:38 +00:00
Marshall Clow
9ac5bc5596 Refactor throw_with_nested. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300197 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 14:41:45 +00:00
Eric Fiselier
d3b3b1f4a1 Add TEST_NOEXCEPT_FALSE to support D31738
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300191 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 10:17:23 +00:00
Eric Fiselier
0301092a7b Cleanup any_cast failure test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300175 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 05:27:55 +00:00
Eric Fiselier
e4b267b262 Fix template >> within C++03 code
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300165 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 02:56:03 +00:00
Eric Fiselier
706e2c7374 Diagnose when reverse_iterator is used on path::iterator.
path::iterator isn't a strictly conforming iterator. Specifically
it stashes the current element inside the iterator. This leads to
UB when used with reverse_iterator since it requires the element
to outlive the lifetime of the iterator.

This patch adds a static_assert inside reverse_iterator to disallow
"stashing iterator types", and it tags path::iterator as such a type.

Additionally this patch removes all uses of reverse_iterator<path::iterator>
within the tests.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300164 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 02:54:13 +00:00
Eric Fiselier
dd5982633c Fix C++03 test failures
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300159 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:13:58 +00:00
Eric Fiselier
0cb22a2fb4 Add tests that std::unique_ptr's default constructor is constexpr.
std::unique_ptr's default constructor must be constexpr in order
to allow constant initialization to take place for static objects;
Even though we can never have a constexpr unique_ptr variable since
it's not a literal type.

This patch adds tests that constant initialization takes place by
using the __attribute__((require_constant_initialization)) macro.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300158 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:11:58 +00:00
Eric Fiselier
3b7f79609f Update tests -verify error messages after r300140.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300156 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:03:41 +00:00
Eric Fiselier
dca3bcdd97 Fix more bad member swap definitions in unordered_map.
The __unordered_map_equal and __unordered_map_hash wrappers
attempt to swap const qualified predicates whenever the predicate
is empty, and is subject to the EBO.

Swapping const values seems blatently incorrect. This patch removes
the const qualifier so the values are swapped as non-const.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300154 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:02:41 +00:00
Eric Fiselier
55d7bd0e5f Fix the default constructibility of __compressed_pair.
This patch fixes a bug where the =default default ctor for
__compressed_pair was incorrect for const qualified types.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300152 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 00:50:45 +00:00
Eric Fiselier
161ccc1a72 Fix most failures caused by r300140
r300140 introduced a bunch of failures by changing the internal
interface provided by __compressed_pair. This patch fixes all of
the failures caused by the new interface by changing the existing
code to use it.

In addition to those changes this patch also fixes two separate
issues causing test failures:

1) Fix the member swap definition for __map_value_compare. Previously
   the swap was incorrectly configured to swap the comparator as const.

2) Fix an assertion failure in futures.task.members/ctor_func_alloc.pass.cpp
that incorrectly expected a move to take place when a single copy is sufficient.

There is one remaining failure regarding make_shared. I'll commit a fix for that
shortly.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300148 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 00:34:24 +00:00
Eric Fiselier
db14bcc51c [libcxx] Fix __compressed_pair so it doesn't copy the argument multiple times, and add constexpr.
Summary:
__compressed_pair takes and passes it's constructor arguments by value. This causes arguments to be moved 3 times instead of once. This patch addresses that issue and fixes `constexpr` on the constructors.

I would rather have this fix than D27564, and I'm fairly confident it's not ABI breaking but I'm not 100% sure.

I prefer this solution because it removes a lot of code and makes the implementation *much* smaller.

Reviewers: mclow.lists, K-ballo

Reviewed By: K-ballo

Subscribers: K-ballo, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300140 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:45:53 +00:00
Eric Fiselier
87fd9b2370 Fix test failures with older Clang versions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300132 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:17:17 +00:00
Eric Fiselier
7b41c797ba [libc++] Implement LWG 2911 - add an is_aggregate type-trait
Summary:
This patch implements http://cplusplus.github.io/LWG/lwg-defects.html#2911.

I'm putting this up for review until __is_aggregate is added to clang (See D31513)

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300126 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 23:08:46 +00:00
Marshall Clow
9bd669bd90 Additional test file for r300123
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300124 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 22:51:56 +00:00
Marshall Clow
22381ddf4f Implement part of LWG#2857 - any/optional. Still to do - variant. Reviewed as https://reviews.llvm.org/D31956
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300123 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 22:51:27 +00:00
Eric Fiselier
39683f1377 Fix incorrectly qualified return type from unique_ptr::get_deleter().
For reference deleter types the const qualifier on the return type
of get_deleter() should be ignored, and a non-const deleter should
be returned.

This patch fixes a bug where "const deleter_type&" is incorrectly
formed.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300121 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 22:43:49 +00:00
Shoaib Meenai
6d5fdc110f [libc++] Use more appropriate conditional for ABI macro definition
The inline function definition ABI macro is gated on COFF dllexport
semantics, so it's more appropriate to mark it with the object file
format macro rather than the generic _WIN32 macro. We now have no uses
of _WIN32 apart from those used to define the other Windows macros :)

Clarify the ABI macro comment and make the object file format check
exhaustive while I'm here.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300097 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 19:56:37 +00:00
Stephan T. Lavavej
00f804a0a5 [libcxx] [test] Avoid Clang's -Wunused-const-variable in is_constructible.pass.cpp.
This happens when using Clang with MSVC's STL, so there are no actual uses of this variable.

Fixes D31966.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300079 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 17:16:38 +00:00
Marshall Clow
a98a45148f Add some FAIL constexpr tests for optional's copy/move ctors.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300009 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 00:07:29 +00:00
Marshall Clow
01208afbd6 Implement LWG#2873: 'Add noexcept to several shared_ptr related functions' This issue missed a couple, so I added those as well (see LWG#2942)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299963 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 17:08:53 +00:00
Ben Craig
fe1d923fd3 [libc++] Fix unknown pragma warning on MSVC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299942 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 14:06:39 +00:00
Marshall Clow
41324261fa Mark P0599 as complete. It was implemented in r298573
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299941 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 14:04:03 +00:00
Marshall Clow
f4f8803751 Fix a C++03 failure
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299909 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 01:54:48 +00:00
Marshall Clow
726efd8dfd Remove some trigraphs that GCC was complaining about
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299907 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11 00:18:28 +00:00
Marshall Clow
a43fe06888 Fix PR#32605: common_type<T> is not SFINAE-friendly
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299901 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 23:47:47 +00:00
Marshall Clow
c50c6b79c3 Fix PR#32606: std::decay mishandles abominable function types
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299894 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-10 22:51:07 +00:00
Akira Hatanaka
733ab2f9f0 Revert "Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions."
This reverts commit r299734.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299744 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-07 05:55:28 +00:00
Shoaib Meenai
04b59f934e [libc++] Drop support for CRTs older than VS 2015
LLVM dropped support for Visual Studio versions older than 2015 quite
some time ago, so I consider it safe to drop libc++'s support for older
CRTs. The CRT in Visual Studio 2015 provides a lot of previously missing
functions, so targeting it requires less special casing.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299743 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-07 02:20:52 +00:00
Billy Robert O'Neal III
0bdae913c3 Add noexcept(false) to more strongly indicate that not being noexcept is important for hash tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299735 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 23:50:33 +00:00
Billy Robert O'Neal III
2889d45aaa Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions.
These tests were unconditionally asserting that optional and unique_ptr declare throwing hashes, but MSVC++ implements conditional noexcept forwarding that of the underlying hash function. As a result we were failing these tests but there's nothing forbidding strengthening noexcept in that way.

Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have non-noexcept hash functions.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299734 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 23:50:21 +00:00
Petr Hosek
effdf248ec [CMake][libcxx] Use check_c_compiler_flag to check for nodefaultlibs
We're using -nodefaultlibs to avoid the dependency on C++ library
when using check_cxx_compiler_flag, and as such we cannot use
check_cxx_compiler_flag to check the availability of -nodefaultlibs
itself.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299711 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 21:06:33 +00:00
Marshall Clow
abdcc5c29c Some of Eric's buildbots don't like this test. Disable it while I figure out why.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299686 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 18:54:37 +00:00
Marshall Clow
e7a5f18b1c Recommit awk tests with warnings removed. Initial commit r299652, reverted r299656.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299680 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 18:34:36 +00:00
Mehdi Amini
4cbff19346 Revert "Restore Missing awk regex tests. Thanks to dexonsmith for noticing, and proposing this as https://reviews.llvm.org/D16541"
This reverts commit r299652, 32bits MacOS is broken.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299656 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 15:56:55 +00:00
Marshall Clow
de4f6cbb5e Restore Missing awk regex tests. Thanks to dexonsmith for noticing, and proposing this as https://reviews.llvm.org/D16541
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299652 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 14:32:42 +00:00
Shoaib Meenai
9a13b433e3 [libc++] Respect Windows Store app CRT restrictions
Some CRT APIs are unavailable for Windows Store apps [1]. Detect when
we're targeting the Windows Store and don't try to refer to non-existent
CRT functions in that case. (This would otherwise lead to a compile
error when using the libc++ headers and compiling for Windows Store.)

[1] https://docs.microsoft.com/en-us/cpp/cppcx/crt-functions-not-supported-in-universal-windows-platform-apps

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299625 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 04:47:49 +00:00
Mehdi Amini
2fe5562fc1 Fix remote test execution in lit
Can be used as such:

  $ python /path/to/lit.py -sv /path/to/llvm/build/projects/libcxx/test/ \
    --param=use_system_cxx_lib=true \
    --param=executor='SSHExecutor("remote.domain", "username")'

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299607 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 01:14:57 +00:00
Mehdi Amini
6dcde2cf11 Use alternate string layout for ARMv7k
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299606 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06 01:10:22 +00:00