Commit Graph

2894 Commits

Author SHA1 Message Date
Eric Fiselier
03388d19d6 Make move_assign_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276591 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 00:18:12 +00:00
Eric Fiselier
f4a698aa30 Make swap_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com.
See D21820 for more information (https://reviews.llvm.org/D21820).



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276590 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 00:15:29 +00:00
Eric Fiselier
ec1f15d9af Work around MSVC's non-standard ABI for enums. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276589 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 00:02:23 +00:00
Eric Fiselier
3a974c6835 Fix a non-standard allocator in vector tests. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276588 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 23:49:42 +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
aafdbda646 Fix portability issues in <random> tests. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 23:36:18 +00:00
Eric Fiselier
5eec7d6e30 Mark bucket() assertions as non-portable. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276584 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 23:34:18 +00:00
Eric Fiselier
e3ecccdf48 Fix MSVC unreferenced parameter warning. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276583 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 23:32:48 +00:00
Eric Fiselier
a29e0e5ba2 Make move_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276581 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 23:19:51 +00:00
Eric Fiselier
7ee04dd6f2 Make bucket_count() greater-equal assertions portable. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276580 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 23:16:37 +00:00
Eric Fiselier
a3db71902a Mark bucket_size() assertions as non-portible. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276578 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 23:13:36 +00:00
Eric Fiselier
a54d1cb852 Guard libc++ specific tests SFINAE on std::bind's call operator. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276576 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 23:08:21 +00:00
Eric Fiselier
923899e665 commit test missing from r276556
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276558 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 08:16:37 +00:00
Eric Fiselier
15d8a56532 Add __is_inplace_type metafunction helper
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276556 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 07:42:13 +00:00
Eric Fiselier
b90f9db20e Start adding benchmarks for vector
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276552 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 06:51:55 +00:00
Eric Fiselier
d7570906b1 Skip chash computation in insert/emplace if the unconstrained hash matches.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276549 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 06:22:25 +00:00
Eric Fiselier
8b5233f11c Make pair/tuples assignment operators SFINAE properly.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276548 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 05:51:11 +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
e1a41a9f4d Implement LWG 2393. Check for LValue-callability.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276546 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 04:16:40 +00:00
Eric Fiselier
7f630e8ffa Implement LWG2328. Rvalue stream extraction should perfect forward.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276545 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-24 04:07:22 +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
eef85d9044 Implement the in_place tags from p0032r3.
That paper also has changes to any/optional but those will
be implemented later.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276537 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-23 22:19:19 +00:00
Eric Fiselier
f6535885b9 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276533 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-23 20:36:55 +00:00
Eric Fiselier
2645dbe87f Implement P0392r0. Integrate filesystem::path and string_view.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276511 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-23 03:10:56 +00:00
Eric Fiselier
bdbae4cbad 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.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276507 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-23 01:43:53 +00:00
Eric Fiselier
ea213b96a6 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276506 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-23 01:16:55 +00:00
JF Bastien
c61cb6d646 Remove FIXME for feature test macro
The value I'd picked was correct, as per the recently published SG10 paper http://wg21.link/p0096r3

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276309 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 17:34:28 +00:00
Marshall Clow
7c56f99282 Again, w/o the tabs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276273 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 13:19:36 +00:00
Marshall Clow
f82c1cef1d Another fix to appease the no-exception bots.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276272 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 13:18:50 +00:00
Marshall Clow
15362334f6 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276241 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 06:24:04 +00:00
Marshall Clow
1e00d6db31 Implement std::string_view as described in http://wg21.link/P0254R1. Reviewed as https://reviews.llvm.org/D21459
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276238 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 05:31:24 +00:00
Eric Fiselier
f50841f3ac Mark P0358r1 as complete. It is already implemented
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276233 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 03:28:52 +00:00
Eric Fiselier
4a2b9335bb Mark P0337r0 as complete. It was already implemented in std::experimental
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276231 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 03:24:43 +00:00
Eric Fiselier
3816ef98b1 Implement P0084r2. Changing emplace return types.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276230 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 03:20:17 +00:00
Eric Fiselier
2edb326926 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.




git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276208 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 23:37:28 +00:00
Eric Fiselier
b5bdc070f2 Unbreak traits tests by handling differences between version macros in clang/apple-clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276200 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 22:53:21 +00:00
Eric Fiselier
bda156d540 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.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276093 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 06:46:22 +00:00
Eric Fiselier
62365dc24e 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()].




git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276092 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 06:36:11 +00:00
Eric Fiselier
7ee34209c6 Add missed test in r276090.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276091 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 05:22:35 +00:00
Eric Fiselier
16ed718fc6 Move std::function constructor SFINAE into template parameter list. Fixes PR20002.
Although inheriting constructors have already been fixed in Clang 3.9 I still
choose to fix std::function so users can derive from it with older compilers.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276090 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 05:21:00 +00:00
Eric Fiselier
155b681794 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276084 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 05:01:24 +00:00
Eric Fiselier
9c747b9e89 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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276078 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 02:57:39 +00:00
Eric Fiselier
781fb2a738 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276067 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 00:14:10 +00:00
Eric Fiselier
99029f12eb Add heterogeneous comparator support for __debug_less. Fixes PR17147.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276059 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19 23:27:18 +00:00
Eric Fiselier
d9b9ef75a8 [libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:

1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.

Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks`  can be built using the `libcxx-benchmarks` target.

On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.

Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.

Known Issues:

* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.








Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs

Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276049 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19 23:07:03 +00:00
Eric Fiselier
7310ec83f3 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276003 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19 17:56:20 +00:00
Marshall Clow
fc8847cefa Bump version # to 4.0.0
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275904 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 20:27:19 +00:00
Marshall Clow
65eb1e90fa Don't use pthread initializers in constexpr constructors. Patch by elram. Reviewed at https://reviews.llvm.org/D21637.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275819 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 17:23:06 +00:00
Marshall Clow
3f013898d1 Change a couple ifdefs from '#if __cplusplus >= 2011xxx' to '#ifndef _LIBCPP_CXX03_LANG'. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275787 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 13:19:00 +00:00
Eric Fiselier
066feb8249 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275772 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 06:15:55 +00:00