Commit Graph

4306 Commits

Author SHA1 Message Date
Shoaib Meenai a4a3d40eb6 [libc++] Clarify names of ABI forcing macros
Make it clear that these are intended only to force a specific ABI when
the autodetection would give the wrong result by renaming the cmake
options and adding separate forcing macros, as suggested by EricWF in
the post-commit review of r314949 and further discussed on IRC.

llvm-svn: 314965
2017-10-05 02:18:08 +00:00
Shoaib Meenai 89937534b2 [libc++] Move cache variable definition. NFC
Move it to where the other ABI cache variables/options are defined.

llvm-svn: 314950
2017-10-04 23:51:57 +00:00
Shoaib Meenai d456385043 [libc++] Allow users to explicitly specify ABI
libc++'s current heuristic for detecting Itanium vs. Microsoft ABI falls
short in some cases. For example, it will detect windows-itanium targets
as using the Microsoft ABI, since they set `_MSC_VER` (for compatibility
with Microsoft headers). Leave the current heuristic in place by default
but also allow users to explicitly specify the ABI if need be.

llvm-svn: 314949
2017-10-04 23:44:38 +00:00
Eric Fiselier 6efa277764 Fix accidental assignment inside test asserts
llvm-svn: 314947
2017-10-04 23:21:18 +00:00
Shoaib Meenai 8e62812ed3 [libc++] Add site config option for ABI macros
Some ABI macros affect headers, so it's nice to have a site config
option for them. Add a LIBCXX_ABI_DEFINES cmake macro to allow
specifying a list of ABI macros to define in the site config.

The primary design constraint (as discussed with Eric on IRC a while
back) was to not have to repeat the ABI macro names in cmake, which only
leaves a free-form cmake list as an option. A somewhat unfortunate
consequence is that we can't verify that the ABI macros being defined
actually exist, though we can at least perform some basic sanity
checking, since all the ABI macros begin with _LIBCPP_ABI_.

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

llvm-svn: 314946
2017-10-04 23:17:12 +00:00
Marshall Clow e0755113fb Initial cut at infastructure for fuzzing support for OSS-fuzz
llvm-svn: 314940
2017-10-04 22:23:03 +00:00
Eric Fiselier af65856eec Add C++17 explicit deduction guides to std::pair.
This patch adds the newly standardized deduction guides
for std::pair, allowing it to work class template deduction.

llvm-svn: 314864
2017-10-04 00:04:26 +00:00
Eric Fiselier 21cca5c2dc Fix test suite misconfiguration on OS X
llvm-svn: 314755
2017-10-03 02:25:05 +00:00
Eric Fiselier 8f1a5d39de Improve test runner output for broken configurations.
Previously LIT would often fail while attempting to set up/configure
the test compiler; normally when attempting to dump the builtin macros.
This sort of failure provided no useful information about what went
wrong with the compiler, making the actual issues hard --- if not
impossible --- to debug easily.

This patch changes the LIT configuration to report the failure explicitly,
including the failed compile command and the stdout/stderr output.

llvm-svn: 314735
2017-10-02 22:52:51 +00:00
Casey Carter 6ae59c599b [test] Allow other implementations to strengthen noexcept on deque's move constructor
llvm-svn: 314608
2017-09-30 23:15:22 +00:00
Casey Carter 0d1cfc96e5 [test] forwardlist.cons/move_noexcept.pass.cpp
* Don't forbid non-libc++ implementations from strengthening noexcept on forward_list's move constructor.

llvm-svn: 314459
2017-09-28 20:23:43 +00:00
Stephan T. Lavavej e23dde6449 [libcxx] [test] Fix unused local typedef warnings.
llvm-svn: 314259
2017-09-26 23:08:43 +00:00
Stephan T. Lavavej 326df3d819 [libcxx] [test] Strip trailing whitespace.
llvm-svn: 314258
2017-09-26 23:08:41 +00:00
Stephan T. Lavavej 1d8a407e64 [libcxx] [test] Silence warning C4324 for MSVC.
This warning "structure was padded due to alignment specifier" says
that the compiler is going to do exactly what you asked it to do.
It's triggered by the tests for over-aligned dynamic memory allocation.

llvm-svn: 314257
2017-09-26 23:08:39 +00:00
Marshall Clow 08bba64a10 Revert 313789 because gcc doesn't like it
llvm-svn: 313803
2017-09-20 19:38:43 +00:00
Marshall Clow 8f27eef230 Mark the __eval methods on independent_bits_engine (and __independent_bits_engine) as const, since they make no changes to the object. NFC.
llvm-svn: 313789
2017-09-20 18:32:08 +00:00
Marshall Clow 5beb2c3ab3 Fix a bit of UB in __independent_bits_engine. Fixes PR#34663
llvm-svn: 313776
2017-09-20 17:34:11 +00:00
Zachary Turner 3dd2356b3a Make libcxx tests work when llvm sources are not present.
Despite a strong CMake warning that this is an unsupported
libcxx build configuration, some bots still rely on being
able to check out lit and libcxx independently with no
LLVM sources, and then run lit against libcxx.

A previous patch broke that workflow, so this is making it work
again.  Unfortunately, it breaks generation of the llvm-lit
script for libcxx, but we will just have to live with that until
a solution is found that allows libcxx to make more use of
llvm build pieces.  libcxx can still run tests by using the
ninja check target, or by running lit.py directly against the
build tree or source tree.

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

llvm-svn: 313763
2017-09-20 16:01:50 +00:00
Weiming Zhao fbfaec7089 [libc++] Replace __sync_* functions with __libcpp_atomic_* functions
Summary:
This patch replaces __sync_* with __libcpp_atomic_* and adds a wrapper
function for __atomic_exchange to support _LIBCPP_HAS_NO_THREADS.

Reviewers: EricWF, jroelofs, mclow.lists, compnerd

Reviewed By: EricWF, compnerd

Subscribers: compnerd, efriedma, cfe-commits, joerg, llvm-commits

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

llvm-svn: 313694
2017-09-19 23:18:03 +00:00
Zachary Turner 50105d2942 Resubmit "Fix llvm-lit script generation in libcxx."
After speaking with the libcxx owners, they agreed that this is
a bug in the bot that needs to be fixed by the bot owners, and
the CMake changes are correct.

llvm-svn: 313643
2017-09-19 17:19:10 +00:00
Zachary Turner 0556b995e1 Revert "Fix llvm-lit script generation in libcxx."
This reverts commit 4ad71811d45268d81b60f27e3b8b2bcbc23bd7b9.

There is a bot that is checking out libcxx and lit with nothing
else and then running lit.py against the test tree.  Since there's
no LLVM source tree, there's no LLVM CMake.  CMake actually
reports this as a warning saying unsupported libcxx configuration,
but I guess someone is depending on it anyway.

llvm-svn: 313607
2017-09-19 03:11:35 +00:00
Zachary Turner cbafb0f8e1 Fix llvm-lit script generation in libcxx.
Differential Revision: https://reviews.llvm.org/D37997

llvm-svn: 313606
2017-09-19 02:46:28 +00:00
Eric Fiselier 1468677cbe Fix failing ASAN test
llvm-svn: 313576
2017-09-18 22:01:18 +00:00
Eric Fiselier 969db423c0 Fix two failing -verify tests to tolerate old and new clang versions
llvm-svn: 313502
2017-09-17 21:50:59 +00:00
Eric Fiselier 80705d8a47 Update changelog revision
llvm-svn: 313501
2017-09-17 21:00:27 +00:00
Eric Fiselier d87b880e00 ABI: Fix for undefined "___cxa_deleted_virtual" symbol in MacOSX
Patch from Eddie Elizondo. Reviewed as D37830 (https://reviews.llvm.org/D37830).

On MacOSX the following program:

struct S { virtual void f() = delete; };
int main() { new S; }
Fails with the following error:

Undefined symbols for architecture x86_64:
  "___cxa_deleted_virtual"
This adds a fix to export the needed symbols.

Test:

> lit -sv test/libcxx/language.support/cxa_deleted_virtual.pass.cpp
> Testing Time: 0.21s
>   Expected Passes    : 1

llvm-svn: 313500
2017-09-17 20:59:43 +00:00
Eric Fiselier 6b76a681dd 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.

llvm-svn: 313499
2017-09-17 20:57:05 +00:00
Shoaib Meenai 03e314bb0d [libc++] Account for Microsoft CRT const overloads
Microsoft's CRT already provides the const overloads, and it defines the
`_CRT_CONST_CORRECT_OVERLOADS` macro to indicate their presence. Check
for this macro before attempting to define our own const-correct
overloads, to avoid compiler warnings about casts dropping const
qualifiers.

llvm-svn: 313377
2017-09-15 18:49:34 +00:00
Shoaib Meenai c3f5cc8e78 [libc++] Remove unnecessary struct tag
It causes warnings about mismatched tags, and it's not needed.

llvm-svn: 313345
2017-09-15 06:19:31 +00:00
Saleem Abdulrasool e7b38cdc00 typeinfo: provide a partial implementation for Win32
The RTTI structure is different on Windows when building under MS ABI.
Update the definition to reflect this. The structure itself contains an
area for caching the undecorated name (which is 0-initialized). The
decorated name has a bitfield followed by the linkage name. When
std::type_info::name is invoked for the first time, the runtime should
undecorate the name, cache it, and return the undecorated name. This
requires access to an implementation of __unDName. For now, return
the raw name.

This uses the fnv-1a hash to hash the name of the RTTI. We could use an
alternate hash (murmur? city?), but, this was the quickest to throw
together.

llvm-svn: 313344
2017-09-15 05:42:39 +00:00
Eric Fiselier 9f8fef9504 Fix accidental ADL in std::allocator_traits meta-programming.
There were a number of cases where __double_underscore functions,
for example __has_construct_test, were called without being qualified,
causing ADL to occur. This patch qualifies those calls to avoid this
problem.

Thanks to David L. Jones for point out the issue initially.

llvm-svn: 313324
2017-09-15 00:31:38 +00:00
Shoaib Meenai 87fc45800a [libc++] Prevent stale site configuration headers
If we define cmake macros that require a site config, and then undefine
all such macros, a stale site config header will be left behind.
Explicitly delete any generate site config if we don't need one to avoid
this.

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

llvm-svn: 313284
2017-09-14 18:23:43 +00:00
Martin Storsjo fb8eb6fce8 Use CMAKE_AR instead of the system default 'ar' for merging static libraries
Using the system default 'ar' might not be the right choice when
cross compiling.

Don't prepend the ar options by a dash, not all ar implementations
support that (llvm-ar doesn't).

Also pass the 's' option when creating the merged library, to create
an index.

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

llvm-svn: 313122
2017-09-13 06:55:44 +00:00
Marshall Clow bff66aab70 Mark the new tests as unsupported when there are no exceptions
llvm-svn: 313092
2017-09-12 23:33:34 +00:00
Martell Malone f922501d98 libcxx: fix merge_archives error variable name
Differential Revision: https://reviews.llvm.org/D37728

llvm-svn: 313084
2017-09-12 22:32:02 +00:00
Martin Storsjo 499f58a548 Handle object files named *.obj in merge_archives.py
Differential Revision: https://reviews.llvm.org/D37133

llvm-svn: 313072
2017-09-12 20:54:15 +00:00
Marshall Clow c589f5f875 XFAIL a couple of new <regex> tests for C++03
llvm-svn: 313064
2017-09-12 19:01:32 +00:00
Marshall Clow 5a72679338 Apply D28224: 'Throw exception after too many steps' Fixes PR#20291. Thanks to Tim Shen for the patch
llvm-svn: 313056
2017-09-12 17:56:59 +00:00
Marshall Clow d90758e2ef Make pbump (internally) handle sizes bigger than MAX_INT. Fixes PR#33725 - thanks to Jonathan Wakely for the report
llvm-svn: 313031
2017-09-12 15:00:43 +00:00
Marshall Clow 31372681be mark mersenne_twister_engine<>::seed(result_type __sd) with _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK to placate UBSAN. Fixes PR#34160
llvm-svn: 312932
2017-09-11 18:10:33 +00:00
Marshall Clow bc455478e1 Add include of <string> to <system_error>, since things in there return strings. Fixes PR#34529.
llvm-svn: 312923
2017-09-11 16:05:42 +00:00
Eric Fiselier 94d555116c Fix PR34298 - Allow std::function with an incomplete return type.
This patch fixes llvm.org/PR34298. Previously libc++ incorrectly evaluated
the __invokable trait via the converting constructor `function(Tp)` [with Tp = std::function]
whenever the copy constructor or copy assignment operator
was required. This patch further constrains that constructor to short
circut before evaluating the troublesome SFINAE when `Tp` matches
std::function.

The original patch is from Alex Lorenz.

llvm-svn: 312892
2017-09-10 23:41:20 +00:00
Eric Fiselier 85cde7d2f4 Revert "Fix PR34298 - Allow std::function with an incomplete return type."
This reverts commit r312890 because the test case fails to compile for
older versions of Clang that reject initializing a const object without
a user defined constructor.

Since this patch should go into 5.0.1, I want to keep it an atomic change,
and will re-commit it with a fixed test case.

llvm-svn: 312891
2017-09-10 23:37:47 +00:00
Eric Fiselier 358ca0c04b Fix PR34298 - Allow std::function with an incomplete return type.
This patch fixes llvm.org/PR34298. Previously libc++ incorrectly evaluated
the __invokable trait via the converting constructor `function(Tp)` [with Tp = std::function]
whenever the copy constructor or copy assignment operator
was required. This patch further constrains that constructor to short
circut before evaluating the troublesome SFINAE when `Tp` matches
std::function.

The original patch is from Alex Lorenz.

llvm-svn: 312890
2017-09-10 23:12:33 +00:00
Brian Cain 086b6682dd XFAIL tests on SLES11
XFAIL some failing tests for SLES11 (older glibc), also replace spaces
in linux distro w/dashes.

llvm-svn: 312774
2017-09-08 03:57:02 +00:00
Marshall Clow 064028bb05 Add even more string_view tests. These found some bugs in the default parameter value for rfind/find_last_of/find_last_not_of
llvm-svn: 312693
2017-09-07 04:19:32 +00:00
Marshall Clow e2addb79b8 Another missing string_view test
llvm-svn: 312691
2017-09-07 03:03:48 +00:00
Marshall Clow b6d73126c8 Add more string_view tests
llvm-svn: 312690
2017-09-07 02:46:09 +00:00
Martin Storsjo f8689b1be1 Redirect strftime_l to the locale-ignorant strftime on mingw
_strftime_l is only available in the numbered msvcrt versions
(starting from msvcr80.dll). In the default configuration, mingw
targets the unversioned msvcrt.dll - and there, _strftime_l is
not available (not even on windows 10).

If __MSVCRT_VERSION__ is set to a higher value (indicating a
non-default target and wanting to link to msvcrXX.dll), use the
correct function.

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

llvm-svn: 312617
2017-09-06 05:07:25 +00:00
Martin Storsjo 783d433f16 Add MINGW_LIBRARIES to the linker flags
This is essential when building with -nodefaultlibs.

This is similar to what already is done in libcxxabi in SVN r302760.

Differential revision: https://reviews.llvm.org/D37207

llvm-svn: 312498
2017-09-04 19:46:53 +00:00