Commit Graph

181 Commits

Author SHA1 Message Date
Michael Park eb8710cb93
[libc++][P0980] Marked member functions move/copy/assign of char_traits constexpr.
Reviewers: ldionne, EricWF, mclow.lists

Reviewed By: ldionne

Subscribers: christof, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D68840
2019-11-11 09:49:48 -08:00
Louis Dionne 6b77ebdc91 [NFC] Strip trailing whitespace from libc++ 2019-10-23 11:19:19 -07:00
Casey Carter 689ce81059
[libc++][NFC] Remove excess trailing newlines from most files
Testing git commit access.
2019-10-23 08:08:57 -07:00
Stephan T. Lavavej 437e0e5191 [libcxx][test][NFC] Fix comment typos.
(Testing git commit access.)
2019-10-22 15:22:13 -07:00
Eric Fiselier af4a29af01 Add forward declaration of operator<< in <string_view> as required.
This declaration was previously missing despite appearing in the
synopsis. Users are still required to include <ostream> to get the
definition of the streaming operator.

llvm-svn: 372909
2019-09-25 18:56:54 +00:00
Nico Weber cc89063bff 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

llvm-svn: 369481
2019-08-21 00:14:12 +00:00
Marshall Clow 7d8274d54d Followup to revision 364545: Turns out that clang issues different errors for C++11 vs c++2a, so I tweaked the 'expected-error' bits that I added to match either of them.
llvm-svn: 364554
2019-06-27 15:37:31 +00:00
Marshall Clow 9318430237 Provide hashers for string_view only if they are using the default char_traits. Seen on SO: test/std/strings/string.view/string.view.hash/char_type.hash.fail.cpp
llvm-svn: 364545
2019-06-27 14:18:32 +00:00
Louis Dionne 64c1d456c1 [libc++] Add missing #include in <cwchar> tests
Thanks to Mikhail Maltsev for the patch.
Differential Revision: https://reviews.llvm.org/D63289

llvm-svn: 363290
2019-06-13 18:24:28 +00:00
Marshall Clow 7fc6a55688 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.
llvm-svn: 362252
2019-05-31 18:35:30 +00:00
Marshall Clow d75a0450ad Ensure that hash<basic_string> uses char_traits. Fixes PR#41876. Reviewed as https://reviews.llvm.org/D61954
llvm-svn: 361201
2019-05-20 21:56:51 +00:00
Marshall Clow ccbe567f46 Get rid of a bunch of 'unused variable' warnings in test when run with debug_level set. NFC
llvm-svn: 359672
2019-05-01 11:25:58 +00:00
Marshall Clow a14b76707c Fix a one more compare test that assumed -1/0/1 instsad of <0/0/>0. NFC.
llvm-svn: 359106
2019-04-24 15:26:45 +00:00
Marshall Clow 98b15320e4 Fix a couple of tests that assumed that compare retunred -1/0/1 instead of <0/0/>0. Thanks to Jonathan Wakely for the report.
llvm-svn: 359104
2019-04-24 15:14:14 +00:00
Louis Dionne 396145d0da [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

llvm-svn: 357775
2019-04-05 16:33:37 +00:00
Billy Robert O'Neal III 4c1581e2da [libcxx] [test] Add missing <stdexcept> to name std::out_of_range to string.conversions\stold.pass.cpp.
llvm-svn: 357547
2019-04-03 00:08:42 +00:00
Billy Robert O'Neal III 7b9e4ebb03 [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

llvm-svn: 357545
2019-04-03 00:05:49 +00:00
Louis Dionne 38b7e74836 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.

llvm-svn: 357536
2019-04-02 22:21:27 +00:00
Louis Dionne 1754774369 [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

llvm-svn: 357531
2019-04-02 21:43:07 +00:00
Louis Dionne afeff20c0f [libc++] Remove unnecessary <iostream> #includes in tests
Some tests #include <iostream> but they don't use anything from the
header. Those are probably artifacts of when the tests were developped.

llvm-svn: 357181
2019-03-28 16:38:15 +00:00
JF Bastien d81df259b3 Fix char.traits.specializations.char8_t main return
llvm-svn: 356504
2019-03-19 19:25:07 +00:00
Marshall Clow 9ea0e473f0 Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. These are just rebranded 'operator[]', and should be noexcept like it is.
llvm-svn: 356435
2019-03-19 03:30:07 +00:00
Eric Fiselier dfce2dd21e Properly constrain basic_string(Iter, Iter, Alloc = A())
llvm-svn: 356140
2019-03-14 12:31:10 +00:00
Louis Dionne 25838c6dac [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

llvm-svn: 354940
2019-02-27 00:57:57 +00:00
JF Bastien 2df59c5068 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

llvm-svn: 353086
2019-02-04 20:31:13 +00:00
Chandler Carruth 57b08b0944 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.

llvm-svn: 351648
2019-01-19 10:56:40 +00:00
Marshall Clow 5a127cdcbf Portability fix: add missing includes and static_casts. Reviewed as https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch.
llvm-svn: 349566
2018-12-18 23:19:00 +00:00
Marshall Clow b766eb96ff Rework the C strings tests to use ASSERT_SAME_TYPE. NFC there. Also change cwchar.pass.cpp to avoid constructing a couple things from zero - since apparently they can be enums in some weird C library. NFC there, either, since the values were never used.
llvm-svn: 349522
2018-12-18 19:07:30 +00:00
Marshall Clow f60c63c090 Implement P1209 - Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532
llvm-svn: 349178
2018-12-14 18:49:35 +00:00
Louis Dionne bca37ac8b8 [libcxx] Fix test on compilers that do not support char8_t yet
llvm-svn: 348846
2018-12-11 14:15:54 +00:00
Marshall Clow f17c5f6ba6 Fix problems with char8_t stuff on compilers that don't support char8_t yet
llvm-svn: 348829
2018-12-11 06:06:49 +00:00
Marshall Clow 7dad0bd68b Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308
llvm-svn: 348828
2018-12-11 04:35:44 +00:00
Marshall Clow 4d64d7dd64 Implement P0966 - string::reserve should not shrink
llvm-svn: 347789
2018-11-28 18:18:34 +00:00
Marshall Clow 289f1ce53e A couple of tests were broken when clang implemented the compiler parts of P0482 (support for char8_t). Comment out those bits until we implement the corresponding bits in libc++
llvm-svn: 347360
2018-11-20 22:55:40 +00:00
Stephan T. Lavavej dec8905e13 [libcxx] [test] Strip trailing whitespace. NFC.
llvm-svn: 346826
2018-11-14 03:06:06 +00:00
Billy Robert O'Neal III ed2f9a6094 [libcxx] [test] Add missing <stdexcept> in several tests.
Reviewed as https://reviews.llvm.org/D50420

llvm-svn: 339209
2018-08-08 00:40:32 +00:00
Marshall Clow 71f1ec7ea1 Turns out that wide literals U"xxx" and u"xxx" are c++11 and later.
llvm-svn: 336880
2018-07-12 02:55:01 +00:00
Marshall Clow b360cbcc4b Same reversed ifdef happened twice. Test fix only, NFC to the library.
llvm-svn: 336856
2018-07-11 21:22:13 +00:00
Marshall Clow 9c43521cd6 Fix a test #ifdef that was reversed. NFC to the library.
llvm-svn: 336855
2018-07-11 21:20:42 +00:00
Marshall Clow 76b26852b6 Implement LWG 2946, 3075 and 3076. Reviewed as https://reviews.llvm.org/D48616
llvm-svn: 336132
2018-07-02 18:41:15 +00:00
Volodymyr Sapsai b9c0b637cc [libcxx] [test] Mark the test as unsupported by apple-clang-8.1.
llvm-svn: 333011
2018-05-22 18:46:16 +00:00
Stephan T. Lavavej ad9545eb30 [libcxx] [test] Fix whitespace, NFC.
test/std almost always uses spaces; now it is entirely tab-free.

llvm-svn: 329978
2018-04-12 23:56:22 +00:00
Marshall Clow 4a6f3c4710 Implement LWG3034: P0767R1 breaks previously-standard-layout types
llvm-svn: 328064
2018-03-21 00:36:05 +00:00
Mike Edwards 8e94aeb5f8 [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.

llvm-svn: 327304
2018-03-12 18:06:37 +00:00
Mike Edwards b9abf3d299 [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.

llvm-svn: 327191
2018-03-10 00:53:05 +00:00
Mike Edwards 231e19ce52 [libcxx][test] Marking libcpp-no-deduction-guides unsupported.
This fixes linux bot failures with r327178.

llvm-svn: 327190
2018-03-10 00:19:25 +00:00
Mike Edwards d0f595d77c 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

llvm-svn: 327178
2018-03-09 22:13:12 +00:00
Stephan T. Lavavej c1fcd97ede [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.

llvm-svn: 326120
2018-02-26 20:47:46 +00:00
Marshall Clow 3c83937370 Add another test case to the deduction guide for basic_string.
llvm-svn: 325740
2018-02-22 05:14:20 +00:00
Eric Fiselier 9491643c4b Fix test failure on compilers w/o deduction guides
llvm-svn: 325205
2018-02-15 02:41:19 +00:00