Commit Graph

3814 Commits

Author SHA1 Message Date
Marshall Clow 4069c2bc48 Implement LWG#2761: 'basic_string should require that charT match traits::char_type'. Tests for string_view, too
llvm-svn: 297872
2017-03-15 18:41:11 +00:00
Mehdi Amini f8764e30d5 Add deployment knobs to tests (for Apple platforms)
The tests for libc++ specify -target on the command-line to the
compiler, but this is problematic for a few reasons.

Firstly, the -target option isn't supported on Apple platforms. Parts
of the triple get dropped and ignored. Instead, software should be
compiled with a combination of the -arch and -m<name>-version-min
options.

Secondly, the generic "darwin" target references a kernel version
instead of a platform version. Each platform has its own independent
versions (with different versions of libc++.1.dylib), independent of the
version of the Darwin kernel.

This commit adds support to the LIT infrastructure for testing against
Apple platforms using -arch and -platform options.

If the host is not on OS X, or the compiler type is not clang or apple-clang, then this commit has NFC.
If the host is on OS X and --param=target_triple=... is specified, then a warning is emitted to use arch and platform instead. Besides the warning, there's NFC.
If the host is on OS X and *no* target-triple is specified, then use the new deployment target logic. This uses two new lit parameters, --param=arch=<arch> and --param=platform=<platform>. <platform> has the form <name>[<version>].
By default, arch is auto-detected from clang -dumpmachine, and platform is "macosx".
If the platform doesn't have a version:
For "macosx", the version is auto-detected from the host system using sw_vers. This may give a different version than the SDK, since new SDKs can be installed on older hosts.
Otherwise, the version is auto-detected from the SDK version using xcrun --show-sdk-path.
-arch <arch> -m<name>-version-min=<version> is added to the compiler flags.
The target triple is computed as <arch>-apple-<platform>. It is *not* passed to clang, but it is available for XFAIL and UNSUPPORTED (as is with_system_cxx_lib=<target>).
For convenience, apple-darwin and <arch>-apple-darwin are added to the set of available features.
There were a number of tests marked to XFAIL on x86_64-apple-darwin11
and x86_64-apple-darwin12. I updated these to
x86_64-apple-macosx10.7 and x86_64-apple-macosx10.8.

llvm-svn: 297798
2017-03-15 00:59:54 +00:00
Billy Robert O'Neal III c32a1bdd5f Fixed unintentional assignment-in-assert in new "extending memory management tools" algorithms.
llvm-svn: 297772
2017-03-14 19:36:30 +00:00
Marshall Clow 47cc7e684f Mark LWG issues 2868, 2872, and 2890 as complete. There's nothing we need to do for them.
llvm-svn: 297758
2017-03-14 17:35:56 +00:00
Marshall Clow e1a292eafd Also mark LWG#2785 as complete, because we already implemented that
llvm-svn: 297753
2017-03-14 17:24:29 +00:00
Marshall Clow 55cfe4c16b Implement LWG2784, and mark 2786, 2795, 2804, 2812, 2826, 2834, 2837 and 2838 as complete - since we do them already
llvm-svn: 297752
2017-03-14 17:08:47 +00:00
Bruno Cardoso Lopes 704c8a929b Fix cmake to find the compiler-rt libs on darwin
Followup for r297553, which left darwin in a broken state
http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan_build/3812

rdar://problem/31011980

llvm-svn: 297703
2017-03-14 04:12:29 +00:00
Eric Fiselier 2b38ed7b15 fix test coverage capture dirs
llvm-svn: 297555
2017-03-11 05:28:09 +00:00
Eric Fiselier 2aeac46e84 Change test coverage generation to use llvm-cov instead of gcov.
Clang doesn't produce gcov compatible coverage files. This
causes lcov to break because it uses gcov by default. This
patch switches lcov to use llvm-cov as the gcov-tool.

Unfortunatly llvm-cov doesn't provide a gcov like interface by
default so it won't work with lcov. However `llvm-cov gcov` does.
For this reason we generate 'llvm-cov-wrapper' script that always
passes the gcov flag.

llvm-svn: 297553
2017-03-11 03:24:18 +00:00
Eric Fiselier d2001dac3f Fix DoNotOptimize on MSVC
llvm-svn: 297532
2017-03-11 00:07:08 +00:00
Eric Fiselier 84a2dadcee Disable unsigned integer sanitizer for basic_string::replace(). Patch from tomcherry@google.com
basic_string::replace() has the below line

__sz += __n2 - __n1;

which fails overflow checks if __n1 > __n2, as the negative result
from the subtraction then overflows the original __sz when added to
it.

This behavior is valid as unsigned integer overflow is defined to wrap
around the maximum value and that produces the correct final value for
__sz.  Therefore, we disable this check on this function.

llvm-svn: 297355
2017-03-09 01:54:13 +00:00
Shoaib Meenai 5e5d8672a7 [libc++] Avoid double defining macro on Windows
Put proper guards around _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS.
No functional change on non-Windows. Avoids incorrect macro redefinition
on Windows.

llvm-svn: 297330
2017-03-09 00:18:00 +00:00
Eric Fiselier e05469392e Fix PR32183 - Wrap GCC exception implementation in missing namespace std
llvm-svn: 297306
2017-03-08 20:06:01 +00:00
Eric Fiselier a655a61394 Add list of filesystem NB comments to TODO.TXT so they can be tracked separately
llvm-svn: 297079
2017-03-06 21:23:36 +00:00
Eric Fiselier 2c36b40a4b Mark LWG 2806 as complete. Libc++ speculatively shiped this change in 4.0
llvm-svn: 297074
2017-03-06 21:09:02 +00:00
Eric Fiselier ef7c5a6b9a Mark LWG 2789 as complete. No changes required
llvm-svn: 297073
2017-03-06 21:07:18 +00:00
Eric Fiselier bc9cbcedc1 Implement LWG 2787 - [file_status.cons] is inconsistent
llvm-svn: 297071
2017-03-06 21:02:06 +00:00
Eric Fiselier fb07598bf7 Mark LWG 2781 as complete. No changes required
llvm-svn: 297069
2017-03-06 20:56:13 +00:00
Eric Fiselier 23e323f284 Mark two any_cast issues as complete
llvm-svn: 297066
2017-03-06 20:49:42 +00:00
Michael Park 6f18866407 Updated email address in `CREDITS.txt`.
llvm-svn: 297065
2017-03-06 20:46:55 +00:00
Marshall Clow 921cab303c Header update with info about the current status of C++17
llvm-svn: 297022
2017-03-06 16:09:02 +00:00
Marshall Clow a6e3972bfc Update list with changes from Kona meeting
llvm-svn: 297021
2017-03-06 16:06:02 +00:00
Eric Fiselier 065c1abc5e Fix nonsense comment
llvm-svn: 296965
2017-03-04 12:28:12 +00:00
Eric Fiselier 51383a60c0 teach LIT how to detect the glibc version
llvm-svn: 296942
2017-03-04 01:29:51 +00:00
Eric Fiselier 5ba962706f Remove the buildit and testit scripts; they haven't been supported in years
llvm-svn: 296922
2017-03-03 22:47:45 +00:00
Eric Fiselier bd6a2d8505 Fix hash requirements check in __hash_table.
r296565 attempted to add better diagnostics when an unordered container
is instantiated with a hash that doesn't meet the Hash requirements.

However I mistakenly checked the wrong set of requirements. Specifically
it checked if the hash met the requirements for specializations of
std::hash. However these requirements are stricter than the generic
Hash requirements.

This patch fixes the assertions to only check the Hash requirements.

llvm-svn: 296919
2017-03-03 22:35:58 +00:00
Mehdi Amini dff33c2760 Fix libc++ test to pass in C++03 mode
Was hitting: "error: scalar initializer cannot be empty"

llvm-svn: 296889
2017-03-03 17:24:29 +00:00
Eric Fiselier 4f73dbf403 Clean up more usages of _LIBCPP_HAS_NO_RVALUE_REFERENCES
llvm-svn: 296854
2017-03-03 03:43:25 +00:00
Eric Fiselier 412e9dbc60 Fix sign-compare warning in test; Oddly this only appears on OS X
llvm-svn: 296851
2017-03-03 02:02:07 +00:00
Eric Fiselier ae85a922d5 Work around test failure on 32 bit OS X
llvm-svn: 296840
2017-03-02 23:18:40 +00:00
Eric Fiselier 25f9f927c6 remove max_size() extension from polymorphic_allocator. It is unneeded
llvm-svn: 296831
2017-03-02 22:10:14 +00:00
Mehdi Amini 9a90c08a62 Fix libc++ test experimental/algorithms/alg.random.sample/sample.pass.cpp when ran in c++11 mode 32 bits
llvm-svn: 296830
2017-03-02 22:08:42 +00:00
Eric Fiselier c7051e706f Work around GCC linking errors within libc++abi due to missing new/delete definitions
llvm-svn: 296822
2017-03-02 21:55:03 +00:00
Eric Fiselier 7709213ece Fix test failures caused by new/delete calls getting optimized away
llvm-svn: 296813
2017-03-02 21:16:35 +00:00
Eric Fiselier 6ab12b3c14 Update ABI list for 4.0 release
llvm-svn: 296805
2017-03-02 19:59:53 +00:00
Eric Fiselier 3499263c36 [libc++] Add option to disable new/delete overloads when libc++abi provides them.
Summary:
Currently both libc++ and libc++abi provide definitions for operator new/delete. However I believe this is incorrect and that one or the other should offer them.

This patch adds the CMake option `-DLIBCXX_ENABLE_NEW_DELETE_DEFINITIONS` which defaults no `ON` unless `-DLIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS=ON` is specified.



Reviewers: mclow.lists, mehdi_amini, dexonsmith, danalbert, smeenai, mgorny, rmaprath

Reviewed By: mehdi_amini

Subscribers: cfe-commits

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

llvm-svn: 296802
2017-03-02 19:35:33 +00:00
Shoaib Meenai bda3c7df78 [libc++] Make _LIBCPP_TYPE_VIS export members
Summary:
Most classes annotated with _LIBCPP_TYPE_VIS need to have at least some
of their members exported, otherwise we have a lot of link errors when
linking against a libc++ built with hidden visibility. This also makes
_LIBCPP_TYPE_VIS be consistent across platforms, since on Windows it
already exports members.

With this change made, any template methods of a class marked
_LIBCPP_TYPE_VIS will also get default visibility when instantiatied,
which is not desirable for clients of libc++ headers who wish to control
their visibility; this is the same issue as PR30642. Annotate all
problematic methods with an explicit visibility specifier to avoid this.

The problematic methods were found by running bad-visibility-finder [1]
against the libc++ headers after making the _LIBCPP_TYPE_VIS change. The
small methods were marked for inlining; the larger ones hidden.

[1] https://github.com/smeenai/bad-visibility-finder

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 296732
2017-03-02 03:22:18 +00:00
Shoaib Meenai bad28c44eb [libc++] Make _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS export members
When building libc++ with hidden visibility, we want explicit template
instantiations to export members. This is consistent with existing
Windows behavior, and is necessary for clients to be able to link
against a hidden visibility built libc++ without running into lots of
missing symbols.

An unfortunate side effect, however, is that any template methods of a
class with an explicit instantiation will get default visibility when
instantiated, unless the methods are explicitly marked inline or hidden
visibility. This is not desirable for clients of libc++ headers who wish
to control their visibility, and led to PR30642.

Annotate all problematic methods with an explicit visibility specifier
to avoid this. The problematic methods were found by running
https://github.com/smeenai/bad-visibility-finder against the libc++
headers after making the _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS change. The
methods were marked with the new _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
macro, which was created for this purpose.

It should be noted that _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS was originally
intended to expand to default visibility, and was changed to expanding
to default type visibility to fix PR30642. The visibility macro
documentation was not updated accordingly, however, so this change makes
the macro consistent with its documentation again, while explicitly
fixing the methods which resulted in that PR.

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

llvm-svn: 296731
2017-03-02 03:02:50 +00:00
Shoaib Meenai a528e74735 [libc++] Mark some std::num_get method templates inline
D29157 will make explicit template instantiations expand to default
visibility, at which point these method templates will need to be
explicitly marked hidden visibility to avoid leaking into other DSOs.
Unfortunately, because of clang PR32114, they must be marked inline (in
conjunction with `-fvisibility-inlines-hidden`) to actually hide them,
since clang doesn't respect the hidden visibility annotation.

Since this involves an ABI change, mark these methods inline in a
separate change, so that the ABI changes can be reviewed separately and
verified to be safe.

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

llvm-svn: 296729
2017-03-02 02:51:27 +00:00
Eric Fiselier e2878b2f97 Remove more usages of REQUIRES-ANY in the test-suite
llvm-svn: 296727
2017-03-02 02:04:49 +00:00
Mehdi Amini 2f75ad4e51 Recommit r296712: "Fix Apple-specific XFAIL directive in libc++ test"
The test is passing with c++11 and c++14 but not c++1z on this
particular version of the compiler. Try to use lit boolean condition
to satisfy this constaint.

llvm-svn: 296725
2017-03-02 02:01:11 +00:00
Mehdi Amini cd0b56c5cf Revert "Fix Apple-specific XFAIL directive in libc++ test"
This reverts commit r296712. It broke our bot.

It turns out that the test is passing with c++11 and c++14 but
not c++1z on this particular version of the compiler. Since one
job is defaulting to c++1z and the other is testing all config I'm
not sure how to fix this...

llvm-svn: 296724
2017-03-02 01:57:40 +00:00
Eric Fiselier 803a491a64 Fix python 3 syntax error in sym_diff
llvm-svn: 296716
2017-03-02 00:03:01 +00:00
Mehdi Amini 48c4a82105 Fix Apple-specific XFAIL directive in libc++ test
This tests is failing in XCode 7.0. But Xcode 7.3 that shipped
an updated clang has this test passing. This is fixing green dragon
which runs this configuration.

llvm-svn: 296712
2017-03-01 23:45:03 +00:00
Mehdi Amini dc5474f800 Fix Apple-specific XFAIL directive in libc++ test
These tests are failing in XCode 8.0, 8.1, and 8.2, but not in Xcode
8.3. Annoyingly the version numbering for clang does not follow Xcode
and is bumped to 8.1 only in Xcode 8.3. So Xfailing apple-clang-8.0
should catch all cases here.

llvm-svn: 296704
2017-03-01 23:14:34 +00:00
Eric Fiselier d94189dc50 Generate the test configuration even when LIBCXX_INCLUDE_TESTS=OFF.
This patch changes the CMake configuration so that it always
generates the test/lit.site.cfg file, even when testing is disabled.

This allows users to test libc++ without requiring them to have
a full LLVM checkout on their machine.

llvm-svn: 296685
2017-03-01 21:53:30 +00:00
Petr Hosek 11d1770e14 [libcxx] Support threads on Fuchsia
Differential Revision: https://reviews.llvm.org/D30278

llvm-svn: 296573
2017-03-01 03:09:18 +00:00
Eric Fiselier f4bf2438c0 Mark test as unsupported in C++11
llvm-svn: 296571
2017-03-01 02:52:04 +00:00
Eric Fiselier 81529ba9ab Fix test failures due to bad test hasher
llvm-svn: 296568
2017-03-01 02:34:27 +00:00
Eric Fiselier acb21581d7 Improve diagnostics when an invalid hash is used in an unordered container.
This patch adds a static assertion that the specified hash meets
the requirements of an enabled hash, and it ensures that the static
assertion is evaluated before __compressed_pair is instantiated.
That way the static assertion diagnostic is emitted first.

llvm-svn: 296565
2017-03-01 02:02:28 +00:00