Commit Graph

110 Commits

Author SHA1 Message Date
Louis Dionne
ee85f7c135 Revert "[libc++] Fix error flags and exceptions propagated from input stream operations"
This reverts commits r357533 and r357531, which broke the LLDB
data formatters. I'll hold off until we know how to fix the data
formatters accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357536 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-02 22:21:27 +00:00
Louis Dionne
59d894965e [libc++] Fix error flags and exceptions propagated from input stream operations
Summary:
Before this patch, we would only ever throw an exception if the badbit
was set on the stream. The Standard is currently very unclear on how
exceptions should be propagated and what error flags should be set by
the input stream operations. This commit changes libc++ to behave under
a different (but valid) interpretation of the Standard. This interpretation
of the Standard matches what other implementations are doing.

I will submit a paper in San Diego to clarify the Standard such that the
interpretation used in this commit (and other implementations) is the only
possible one.

PR21586
PR15949
rdar://problem/15347558

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357531 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-02 21:43:07 +00:00
Marshall Clow
ddb1b0576a Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. These are just rebranded 'operator[]', and should be noexcept like it is.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356435 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 03:30:07 +00:00
Eric Fiselier
a9efe90666 Properly constrain basic_string(Iter, Iter, Alloc = A())
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356140 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 12:31:10 +00:00
Louis Dionne
21c042e77e [libc++] Mark several tests as XFAIL on macosx10.7
Those tests fail when linking against a new dylib but running against
macosx10.7. I believe this is caused by a duplicate definition of the
RTTI for exception classes in libc++.dylib and libc++abi.dylib, but
this matter still needs some investigation.

This issue was not caught previously because all the tests always linked
against the same dylib used for running (because LIT made it impossible
to do otherwise before r349171).

rdar://problem/46809586

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354940 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 00:57:57 +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
Marshall Clow
96484477d1 Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348828 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-11 04:35:44 +00:00
Marshall Clow
7593e799d2 Implement P0966 - string::reserve should not shrink
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347789 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-28 18:18:34 +00:00
Stephan T. Lavavej
439de45011 [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346826 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 03:06:06 +00:00
Billy Robert O'Neal III
8989fab841 [libcxx] [test] Add missing <stdexcept> in several tests.
Reviewed as https://reviews.llvm.org/D50420

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339209 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-08 00:40:32 +00:00
Marshall Clow
64c10d00c3 Implement LWG 2946, 3075 and 3076. Reviewed as https://reviews.llvm.org/D48616
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@336132 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-02 18:41:15 +00:00
Volodymyr Sapsai
72d5c6fbc9 [libcxx] [test] Mark the test as unsupported by apple-clang-8.1.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@333011 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 18:46:16 +00:00
Marshall Clow
256f187bc6 Implement LWG3034: P0767R1 breaks previously-standard-layout types
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@328064 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-21 00:36:05 +00:00
Mike Edwards
ddb6e5f2ef [libcxx][test] Adding apple-clang-9 to UNSUPPORTED in iter_alloc_deduction.fail.cpp.
After two failed attempts last week to make this work I am
going back to a known good method of making this test pass on
macOS...adding the current apple-clang version to the
UNSUPPORTED list.

During a previous patch review (https://reviews.llvm.org/D44103)
it was suggested to just XFAIL libcpp-no-deduction-guides
as was done to iter_alloc_deduction.pass.cpp. However
this caused a an unexpected pass on:
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-gcc-tot-latest-std/builds/214

I then attempted to just mark libcpp-no-deduction-guides
as UNSUPPORTED, however this caused an additional bot
failure.  So I reverted everything (https://reviews.llvm.org/rCXX327191).

To solve this and get work unblocked I am adding
apple-clang-9 to the original UNSUPPORTED list.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327304 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-12 18:06:37 +00:00
Mike Edwards
7c796ffe54 [libcxx][test] Reverting r327178 and r327190.
Reverting changes made to iter_alloc_deduction.fail.cpp
as my changes seem to be making several Linux bots angry.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327191 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-10 00:53:05 +00:00
Mike Edwards
00c27d8a40 [libcxx][test] Marking libcpp-no-deduction-guides unsupported.
This fixes linux bot failures with r327178.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327190 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-10 00:19:25 +00:00
Mike Edwards
057ac7c9da XFAIL: libcpp-no-deduction-guides in libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.fail.cpp
Summary: Refactor the previous version method of marking each apple-clang version as UNSUPPORTED and just XFAIL'ing the libcpp-no-deduction-guides instead.  This brings this test inline with the same style as iter_alloc_deduction.pass.cpp

Reviewers: EricWF, dexonsmith

Reviewed By: EricWF

Subscribers: EricWF, vsapsai, vsk, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@327178 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-09 22:13:12 +00:00
Stephan T. Lavavej
76c246434a [libcxx] [test] Fix MSVC warnings and errors.
test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
Fix MSVC x64 truncation warnings.
warning C4267: conversion from 'size_t' to 'int', possible loss of data

test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
Fix MSVC uninitialized memory warning.
warning C6001: Using uninitialized memory 'vl'.

test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
Include <cassert> for the assert() macro.

Fixes D43273.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@326120 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-26 20:47:46 +00:00
Marshall Clow
2c893111fc Add another test case to the deduction guide for basic_string.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325740 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-22 05:14:20 +00:00
Eric Fiselier
6878e852d1 Fix test failure on compilers w/o deduction guides
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325205 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15 02:41:19 +00:00
Marshall Clow
5bfbd7dacc The apple versions of clang don't support deduction guides yet.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324640 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 19:33:03 +00:00
Marshall Clow
88ba9758ff Once more, with feeling. Spell 'clang-4.0' correctly this time
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324624 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 17:06:08 +00:00
Marshall Clow
0eec3e8b24 Clean up string's deduction guides tests. Mark old versions of clang as unsupported, b/c they don't have deduction guides, even in C++17 mode
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324619 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 16:25:57 +00:00
Marshall Clow
4c153004af Temporarily comment out deduction guide tests while I figure out what to do with old bots
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324573 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 07:20:45 +00:00
Marshall Clow
5b1e87e52d Implement deduction guide for basic_string as described in P0433
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324569 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 06:34:03 +00:00
Marshall Clow
088e6015b2 Fix PR#31454 - 'basic_string<T>::push_back() crashes if sizeof(T)>sizeof(long long)'. We were mishandling the small-string optimization calculations for very large 'characters'. This may be an ABI change (change the size of) strings of very large 'characters', but since they never worked, I'm not too concerned.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324531 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-07 21:30:17 +00:00
Stephan T. Lavavej
8148a70b20 [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319994 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-07 00:50:23 +00:00
Marshall Clow
cd64646026 Ooops. I checked in a test for a bug I haven't fixed yet. Temporrarily commented it out.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319693 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04 20:46:38 +00:00
Marshall Clow
46b4ad5400 Implement P0457R2: 'String Prefix and Suffix Checking' for c++2a
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319687 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04 20:11:38 +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
Marshall Clow
f1729d90b3 More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in string, string_view, and the free function std::empty(). Removed tabs from <string_view>, which is why the diff is so big.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318328 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15 20:02:27 +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
Stephan T. Lavavej
5d5bbc45ab [libcxx] [test] Fix unused local typedef warnings.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@314259 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26 23:08:43 +00:00
Stephan T. Lavavej
a2f0b51b9a [libcxx] [test] Strip trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@314258 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26 23:08:41 +00:00
Marshall Clow
0b9db07158 Add even more string_view tests. These found some bugs in the default parameter value for rfind/find_last_of/find_last_not_of
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@312693 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-07 04:19:32 +00:00
Marshall Clow
cd0354ef44 Another missing string_view test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@312691 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-07 03:03:48 +00:00
Marshall Clow
e942bb000f Add more string_view tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@312690 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-07 02:46:09 +00:00
Stephan T. Lavavej
5d91f314f1 [libcxx] [test] Change comments to say C++ instead of c++. NFC.
This makes them consistent (many comments already used uppercase).

The special REQUIRES, UNSUPPORTED, and XFAIL comments are excluded from this change.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309468 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:35 +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
Billy Robert O'Neal III
90c1331825 Add asserts that the nullptr is maintained in string erase operations.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303899 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 19:01:14 +00:00
Billy Robert O'Neal III
b5a065c209 Fix possible loss of data warnings on amd64
In T_size_size.pass, there is an explicit template argument to std::min to ask
for unsigned, to avoid type deduction errors. However, C1XX' warnings still
hate this use, because a 64 bit value (a size_t) is being passed to a function
accepting an unsigned (a 32 bit value).

Instead, change the tests to pass around std::size_t instances, and explicitly
narrow when constructing the string type under test. This also allows
removal of explicit template arguments to std::min.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302473 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-08 21:54:53 +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
Billy Robert O'Neal III
aa22e515ac Resolve unused local typedef warning in test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300937 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 01:10:04 +00:00
Eric Fiselier
3e92897754 Cleanup _LIBCPP_HAS_NO_<c++11-feature> in the string library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300633 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 00:28:44 +00:00
Eric Fiselier
622c7d5846 Fix PR32642 - string::insert and string::append don't work with move_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300397 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-15 06:49:02 +00:00
Marshall Clow
2d4c3fa48a Implement LWG#2761: 'basic_string should require that charT match traits::char_type'. Tests for string_view, too
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@297872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 18:41:11 +00:00
Eric Fiselier
778ec30428 Work around test failure on 32 bit OS X
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296840 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-02 23:18:40 +00:00
Steven Wu
244033db8b Remove XFAIL in implicit_deduction_guides tests
The clang assertion causing these tests failing with sanitizer is fixed
in r295794. All the bots running libcxx tests should be upgraded and
running the compiler with the fix.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296385 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:10:41 +00:00
Eric Fiselier
224dbbb3d6 Work around Clang assertion when testing C++17 deduction guides with '-g'.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@295417 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-17 05:04:09 +00:00