Commit Graph

115 Commits

Author SHA1 Message Date
Nico Weber
28db4445e2 libcxx: Rename .hpp files in libcxx/test/support to .h
LLVM uses .h as its extension for header files.

Files renamed using:

    for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done

References to the files updated using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
        a=$(basename $f);
        echo $a;
        rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/";
    done

HPP include guards updated manually using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
      echo ${f%.hpp}.h ;
    done | xargs mvim

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369481 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 00:14:12 +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
0c6eb81c47 Get rid of a bunch of 'unused variable' warnings in test when run with debug_level set. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359672 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-01 11:25:58 +00:00
Louis Dionne
0f60e0a4a0 [libc++] Fix error flags and exceptions propagated from input stream operations
Summary:
This is a re-application of r357533 and r357531. They had been reverted
because we thought the commits broke the LLDB data formatters, but it
turns out this was because only r357531 had been included in the CI
run.

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.

This effectively implements the wording in p1264r0. It hasn't been voted
into the Standard yet, however there is wide agreement that the fix is
correct and it's just a matter of time before the fix is standardized.

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@357775 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-05 16:33:37 +00:00
Billy Robert O'Neal III
2b2bf84c98 [libcxx] [test] Fix test bugs in string.cons/copy_alloc.pass.cpp.
Fixed the inability to properly rebind the testing allocator, by making the
inner alloc_impl type a plain struct and making the operations templates. Before
rebind failed to compile complaining that a alloc_impl<T>* was not convertible
to an alloc_impl<U>*.

This enables the test to pass for MSVC++ once we provide the strong guarantee
for the copy assignment operator.

Reviewed as https://reviews.llvm.org/D60023

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357545 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-03 00:05:49 +00:00
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