Commit Graph

728 Commits

Author SHA1 Message Date
Hubert Tong
7f6e8e2141 [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!


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277968 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 22:26:04 +00:00
Hubert Tong
5f9ee490e7 Revert r277966. Forgot patch attribution.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277967 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 22:23:24 +00:00
Hubert Tong
9bae734ed9 [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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277966 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-07 22:18:33 +00:00
Eric Fiselier
2d9e2e2bc8 Fix compile error due to mismatched iterator types. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277574 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 05:50:03 +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
Hubert Tong
b49c67fad2 [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!


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277526 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 21:34:48 +00:00
Marshall Clow
1c1e91d9a3 Implement LCM and GCD for C++17. Same code as for Library Fundamentals TS.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276751 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 14:29:45 +00:00
Marshall Clow
f3e7cacb35 Implement LCM and GCD for Library Fundamentals. Reviewed as https://reviews.llvm.org/D21343.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276750 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 14:28:34 +00:00
Eric Fiselier
b0cf9cb1bc Remove use of C++1z static assert in C++11 test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276608 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 04:56:32 +00:00
Eric Fiselier
e1445fd8ed Implement the std::pair parts of "Improving pair and tuple". Completes N4387.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276605 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 04:32:07 +00:00
Eric Fiselier
4be71c6619 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.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276603 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 02:36:42 +00:00
Eric Fiselier
602fe15f55 Make std::is_assignable tolerate references to incomplete types.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276599 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 02:08:55 +00:00
Eric Fiselier
c76d8f7ff4 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.




git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276598 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 01:45:07 +00:00
Eric Fiselier
775417d97c Make dtor_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 00:50:32 +00:00
Eric Fiselier
932604f8d1 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.




git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276594 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 00:48:36 +00:00
Eric Fiselier
0809a7f62b Mark bucket_count() assertions as non-portable. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276593 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 00:26:41 +00:00
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
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
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
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
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
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
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
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
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
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
Jonas Hahnfeld
b9c20327ac [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275760 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 06:06:50 +00:00
Eric Fiselier
f5750d5c05 Add checkpoint diagnostics to help diagnose buildbot failures.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275754 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 03:00:09 +00:00