Commit Graph

4099 Commits

Author SHA1 Message Date
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
Petr Hosek
1662a857db [CMake][libcxx] Use builtins rather than gcc_s when compiler-rt is requested
When compiler-rt is requested, we should attempt to link compiler-rt
builtins library rather than gcc_s.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299599 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-05 22:53:05 +00:00
Eric Fiselier
607e0c71ec Fix more -Wshadow warnings introduced by recent Clang change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299411 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-04 02:54:27 +00:00
Eric Fiselier
0867373a5c Work around recent -Wshadow changes in Clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299407 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-04 01:05:59 +00:00
Eric Fiselier
6547dc88b4 Fix C++17 dylib build
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299401 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 23:23:44 +00:00
Eric Fiselier
f3b3a65d89 suppress GCC warning about noexcept functions changing mangling
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299385 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 20:53:15 +00:00
Shoaib Meenai
9dcbb46826 [libc++] Explicitly mark specializations as dllexport
Method specializations don't get exported even if there's an exported
extern template instantiation on Windows. Explicitly mark the methods
for export. They're already exported on Linux and Darwin, so there's no
ABI change on those platforms.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299348 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-03 04:04:24 +00:00
Duncan P. N. Exon Smith
ed3c0e6b3f string: Remove always_inline from basic_string::__init
This is effectively a partial revert of r278356, which started inlining
basic_string::__init.  Even if we want to help the compiler along with
an inlinehint, we shouldn't hamstring it by forcing it to inline all the
time.

Libc++ uses always_inline widely as a limit-the-ABI-hack, but since
__init is already on the dylib boundary, it makes no sense here and just
harms the debugging experience at -O0.

rdar://problem/31013102

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299290 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-01 03:20:48 +00:00
Duncan P. N. Exon Smith
cc6415930b Use strong enums independently of -fobjc-arc
r145698 introduced _LIBCPP_HAS_NO_STRONG_ENUMS by copy-pasting the
__has_feature check from objc_arc_weak/_LIBCPP_HAS_OBJC_ARC_WEAK, and
accidentally started defining _LIBCPP_HAS_NO_STRONG_ENUMS whenever
__has_feature(objc_arc_weak).  This is totally bogus, and means that
Libc++ thinks Objective-C++ compilations with -fobjc-arc don't have
strong enums.

Delete the accidental line.

I thought about adding a test, but it would be entirely duplicative of
the patch (if has-feature strong enums, check that has-no-strong-enums
is not defined).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299236 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 17:39:56 +00:00
Reid Kleckner
ccc0f58ef7 Try to fix the libcxx build with mingw64
Summary:
mingw64 has lots of default libs that libc++ and its test programs
should link against.

With this patch, cmake now runs successfully with GCC on Windows.

Reviewers: mati865, EricWF

Subscribers: mgorny, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299144 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 00:34:05 +00:00
Eric Fiselier
2b3c1c4d9b Fix LWG 2934 - optional<const T> doesn't compare with T
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 20:06:52 +00:00
Eric Fiselier
5612bd42dc Implement LWG 2842 - optional(U&&) needs to SFINAE on decay_t<in_place_t>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299100 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 19:43:50 +00:00
Mehdi Amini
9783bae928 libc++ testing: fix invalid python syntax
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299057 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 05:21:33 +00:00
Mehdi Amini
e1d7c51f6e libc++ testing: fix assertion around use_system_cxx_lib
Actually fix (hopefully) the assertions about `use_system_cxx_lib`,
the previous attempt failed because I misread the error.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299056 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 05:07:18 +00:00
Mehdi Amini
6c9ed3296e libc++ config testing: use_system_cxx_lib can be a bool
Fix the libc++ Green Dragon bot.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299055 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 04:51:19 +00:00
Mehdi Amini
3f140f0041 Reexport operator new / delete from libc++abi
Both libc++ and libc++abi export a weak definition of operator
new/delete. On Darwin, this can often cause dirty __DATA in the
shared cache when having to switch from one to the other. Instead,
libc++ should reexport libc++abi's implementation of these symbols.

Patch by: Ted Kremenek <kremenek@apple.com>

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299054 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 04:47:19 +00:00
Mehdi Amini
f18ccd87b3 libc++ testing: allow to provide a path for use_system_cxx_lib
As we're trying to setup testing / bots for all shipping version of libc++
on macOS/iOS, we'll need to be able to pass a path to where to find the
dylib for each previous version of the OS.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299053 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 04:45:33 +00:00
Mehdi Amini
0a74c73d3f Do not pass an explicit reexported symbol list when building libc++ dylib if also defining new/delete
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299052 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 04:40:56 +00:00
Shoaib Meenai
f012f260c3 [libc++] Add a key function for bad_function_call
Summary:
bad_function_call is currently an empty class, so any object files using
that class will end up with their own copy of its typeinfo, typeinfo
name and vtable, leading to unnecessary duplication that has to be
resolved by the dynamic linker. Instead, give bad_function_call a key
function and put a definition for that key function in libc++ itself, to
centralize the typeinfo and vtable.

This is consistent with the behavior for other exception classes. The
key functions are defined in libc++ rather than libc++abi since the
class is defined in the libc++ versioning namespace, so ABI
compatibility with libstdc++ is not a concern.

Guard this change behind an ABI macro, since it isn't backwards
compatible (i.e., clients built against the new libc++ headers wouldn't
be able to run against an older libc++ library).

Reviewers: mclow.lists, EricWF

Subscribers: mgorny, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298937 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-28 19:33:31 +00:00
Marshall Clow
0b148779b3 Mark *pass tests as UNUSUPPORTED instead of XFAIL on old compilers
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298839 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-27 10:44:33 +00:00