Commit Graph

28 Commits

Author SHA1 Message Date
JF Bastien
599bf43e56 Fix optional deduction guide test breakage
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333308 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25 20:43:57 +00:00
Marshall Clow
756163dbc1 Add one more test for optional
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333252 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25 02:22:54 +00:00
Marshall Clow
2fac2d790f Add deduction guides for optional
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333251 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25 02:08:49 +00:00
Billy Robert O'Neal III
9ae62c79cc Tolerate [[nodiscard]] annotations in the STL. Reviewed as https://reviews.llvm.org/D39033
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318276 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15 07:40:37 +00:00
Eric Fiselier
dfcb00a2c5 Fix failing -verify tests due to change in Clangs static_assert message.
Clang recently changed the way it outputs static assert diagnostics.
This patch fixes libc++'s -verify tests so they tolerate both the old
and new message format.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@313499 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-17 20:57:05 +00:00
Stephan T. Lavavej
a686caad20 [libcxx] [test] Untabify, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:10 +00:00
Casey Carter
8b30287098 optional: Implement LWG 2900 and P0602
Differential Revision: https://reviews.llvm.org/D32385

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 17:15:49 +00:00
Stephan T. Lavavej
b836deb5db [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305848 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 21:00:02 +00:00
Stephan T. Lavavej
8ba816b366 [libcxx] [test] Remove a Clang/C2 workaround.
Clang/LLVM doesn't need this workaround.

Fixes D33955.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304999 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-08 18:21:59 +00:00
Casey Carter
57a009ae03 add missing constexpr to optional::value_or
[Credit to cpplearner]

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304813 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 18:47:26 +00:00
Marshall Clow
6d52b3b76c Add some constexpr tests for optional's move/copy ctor
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303824 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 00:22:33 +00:00
Marshall Clow
6a5647485a Mark the copy constructor and move
constructor to be constexpr. This only works when the contained type has a constexpr copy/move ctor.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303268 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-17 15:30:01 +00:00
Mehdi Amini
907c1196a7 Add markup for libc++ dylib availability
Libc++ is used as a system library on macOS and iOS (amongst others). In order
for users to be able to compile a binary that is intended to be deployed to an
older version of the platform, clang provides the
availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_
that can be placed on declarations to describe the lifecycle of a symbol in the
library.

See docs/DesignDocs/AvailabilityMarkup.rst for more information.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302172 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 17:08:54 +00:00
Stephan T. Lavavej
559442652c [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 01:43:58 +00:00
Casey Carter
fba865a217 Expand test coverage for LWG2857
* Cover optional's emplace-from-initializer_list overload

* Verify that any::emplace and optional::emplace return a reference to the correct type even for throwing cases.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@301055 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 22:38:59 +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
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
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
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
Stephan T. Lavavej
939607910d [libcxx] [test] Fix Clang -Wunused-local-typedef, part 2/3.
These typedefs were completely unused.

Fixes D29136.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294155 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05 22:47:41 +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
Eric Fiselier
a0b4d55133 Add more tests for optional<const T>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285384 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 06:40:29 +00:00
Eric Fiselier
317120240b Fix unreferenced parameters. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284942 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-23 18:52:58 +00:00
Eric Fiselier
e2c4227504 Fix shadowing warning. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284941 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-23 18:47:58 +00:00
Eric Fiselier
46c0fcb2b3 Update status for std::optional LWG issues and fix an optional SFINAE bug
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284323 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 03:21:35 +00:00
Eric Fiselier
35ce4859dd Implement N4606 optional
Summary:
Adapt implementation of Library Fundamentals TS optional into an implementation of N4606 optional.

  - Update relational operators per http://wg21.link/P0307
  - Update to requirements of http://wg21.link/P0032
  - Extension: Implement trivial copy/move construction/assignment for `optional<T>` when `T` is trivially copyable.

Audit P/Rs for optional LWG issues:
  - 2756 "C++ WP optional<T> should 'forward' T's implicit conversions" Implemented, which also resolves 2753 "Optional's constructors and assignments need constraints" (modulo my refusal to explicitly delete the move operations, which is a design error that I'm working on correcting in the 2756 P/R).
  - 2736 "nullopt_t insufficiently constrained" Already conforming. I've added a test ensuring that `nullopt_t` is not copy-initializable from an empty braced-init-list, which I believe is the root intent of the issue, to avoid regression.
  - 2740 "constexpr optional<T>::operator->" Already conforming.
  - 2746 "Inconsistency between requirements for emplace between optional and variant" No P/R, but note that the author's '"suggested resolution" is already implemented.
  - 2748 "swappable traits for optionals" Already conforming.
  - 2753 "Optional's constructors and assignments need constraints" Implemented.

Most of the work for this patch was done by Casey Carter @ Microsoft. Thank you Casey!



Reviewers: mclow.lists, CaseyCarter, EricWF

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 07:46:20 +00:00
Eric Fiselier
ead5d404cc Revert Add <optional>. Will recommit with better commit message
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283978 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 06:48:31 +00:00
Eric Fiselier
fbc80168bb Add <optional> header.
This patch is largely thanks to Casey Carter @ Microsoft. He did the initial
work of porting our experimental implementation and tests over to namespace
std.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283977 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 06:45:11 +00:00