Commit Graph

30 Commits

Author SHA1 Message Date
Richard Smith
8b2d46d8a2 Fix test failures due to modified wording in Clang diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364241 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-24 22:01:03 +00:00
Marshall Clow
b6e011b18b Add include for 'test_macros.h' to all the tests that were missing them. Thanks to Zoe for the (big, but simple) patch. NFC intended.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@362252 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-31 18:35:30 +00:00
Marshall Clow
a123e7ac83 Add an any_cast test for array types. Thanks to Jonathan Wakely for the suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359085 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-24 12:11:12 +00:00
Louis Dionne
eba9009ffa [libc++] Mark bad_any_cast tests as unsupported when the dylib doesn't support bad_any_cast
With the latest compiler fix to availability, some availability failures
that didn't trigger before now trigger.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356678 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-21 15:37:11 +00:00
Louis Dionne
4806bce5a8 [libc++] Fix XFAILs on macOS when exceptions are disabled
Some tests are marked as failing on platforms where the dylib does not
provide the required exception classes. However, when testing with
exceptions disabled, those tests shouldn't be marked as failing.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353210 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 20:11:58 +00:00
Louis Dionne
60c45f5f7c [libcxx] Start defining lit features for tests depending on availability
This patch removes some vendor-specific availability XFAILs from the
test suite. In the future, when a new feature is introduced in the
dylib, an availability macro should be created and a matching lit
feature should be created. That way, the test suite can XFAIL whenever
the implementation lacks the necessary feature instead of being
cluttered by vendor-specific annotations.

Right now, those vendor-specific annotations are still somewhat cluttering
the test suite by being in `config.py`, but at least they are localized.
In the future, we could design a way to define those less intrusively or
even automatically based on the availability macros that already exist
in <__config>.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353201 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 19:22:38 +00:00
JF Bastien
e15dd4e32e Support tests in freestanding
Summary:
Freestanding is *weird*. The standard allows it to differ in a bunch of odd
manners from regular C++, and the committee would like to improve that
situation. I'd like to make libc++ behave better with what freestanding should
be, so that it can be a tool we use in improving the standard. To do that we
need to try stuff out, both with "freestanding the language mode" and
"freestanding the library subset".

Let's start with the super basic: run the libc++ tests in freestanding, using
clang as the compiler, and see what works. The easiest hack to do this:

In utils/libcxx/test/config.py add:

  self.cxx.compile_flags += ['-ffreestanding']

Run the tests and they all fail.

Why? Because in freestanding `main` isn't special. This "not special" property
has two effects: main doesn't get mangled, and main isn't allowed to omit its
`return` statement. The first means main gets mangled and the linker can't
create a valid executable for us to test. The second means we spew out warnings
(ew) and the compiler doesn't insert the `return` we omitted, and main just
falls of the end and does whatever undefined behavior (if you're luck, ud2
leading to non-zero return code).

Let's start my work with the basics. This patch changes all libc++ tests to
declare `main` as `int main(int, char**` so it mangles consistently (enabling us
to declare another `extern "C"` main for freestanding which calls the mangled
one), and adds `return 0;` to all places where it was missing. This touches 6124
files, and I apologize.

The former was done with The Magic Of Sed.

The later was done with a (not quite correct but decent) clang tool:

  https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed

This works for most tests, though I did have to adjust a few places when e.g.
the test runs with `-x c`, macros are used for main (such as for the filesystem
tests), etc.

Once this is in we can create a freestanding bot which will prevent further
regressions. After that, we can start the real work of supporting C++
freestanding fairly well in libc++.

<rdar://problem/47754795>

Reviewers: ldionne, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353086 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04 20:31:13 +00:00
Chandler Carruth
7c3769df62 Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351648 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 10:56:40 +00:00
Louis Dionne
97c03fb705 [libcxx] Use clang-verify in the lit test suite even when availability is enabled
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347780 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-28 17:31:17 +00:00
Louis Dionne
13b7f7b500 [libcxx] Add availability markup for bad_optional_access, bad_variant_access and bad_any_cast
Reviewers: dexonsmith, EricWF

Subscribers: christof, arphaman, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347219 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-19 15:37:04 +00:00
Eric Fiselier
924b8f34f6 Work around gcc.gnu.org/PR87766
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345425 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-26 20:20:12 +00:00
Roman Lebedev
862878bc38 [libcxx][test] Silence -Wself-assign diagnostics
Summary:
D44883 extends -Wself-assign to also work on C++ classes.
These new warnings pop up in the test suite, so they have to be silenced.

Please refer to the D45082 for disscussion on whether this is the right way to solve this.

Testing: `ninja check-libcxx check-libcxxabi` in stage-2 build.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: Quuxplusone, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329490 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-07 10:36:03 +00:00
Billy Robert O'Neal III
7e250fcdc1 Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-21 21:37:26 +00:00
Billy Robert O'Neal III
b981667776 Tolerate even more [[nodiscard]] in the STL. Reviewed as https://reviews.llvm.org/D39080
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318277 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15 07:45:07 +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
f7aaaaaa65 Fix two failing -verify tests to tolerate old and new clang versions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@313502 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-17 21:50:59 +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
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
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
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
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
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
77dabb302b Test changes for P0504R0 "Revisiting in-place tag types for any/optional/variant". Patch from Casey Carter
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287249 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-17 19:23:35 +00:00
Casey Carter
856947863f Cleanup nonportable behavior in tests for std::any
Fixes MS issues 63, 64, and 65.

test/std/utilities/any/any.class/any.cons/move.pass.cpp:
* "Moves are always destructive" is not a portable assumption; check with LIBCPP_ASSERT.

test/std/utilities/any/any.class/any.cons/value.pass.cpp:
* The standard does not forbid initializing std::any from any pointer-to-function type. Remove the non-conforming "DecayTag" test.

test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp:
* Self-swap is not specified to perform no moves; check with LIBCPP_ASSERT.

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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285234 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-26 20:18:13 +00:00
Eric Fiselier
4035b668e6 Make any_cast<void()>(nullptr) compile
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284333 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 11:56:38 +00:00
Eric Fiselier
846edfb837 Update issue status for LWG 2744
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284322 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 02:51:50 +00:00
Eric Fiselier
100a39d169 Update issue status for LWG 2768 and 2769
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284321 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 01:43:43 +00:00
Eric Fiselier
2c429bee79 Fix various issues in std::any and the related tests.
* Fix self-swap. Patch from Casey Carter.

* Remove workarounds and tests for types with deleted move constructors. This
  was originally added as part of a LWG proposed resolution that has since
  changed.

* Re-apply most recent PR for LWG 2769.

* Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to
  use the decayed type.

* Fix tests to allow moved-from std::any's to have a non-empty state. This is
  the behavior of MSVC's std::any.

* Various whitespace and test fixes.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283606 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 21:27:45 +00:00
Eric Fiselier
db4d7e96ca Improve constexpr tests for std::any
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@280777 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 02:38:48 +00:00
Eric Fiselier
e739d54f86 [libcxx] Add std::any
Summary:
This patch adds std::any by moving/adapting <experimental/any>.

This patch also implements the std::any parts of p0032r3 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0032r3.pdf)
and LWG 2509 (http://cplusplus.github.io/LWG/lwg-defects.html#2509).

I plan to push it in a day or two if there are no comments.


Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@278310 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 03:13:11 +00:00