Commit Graph

5450 Commits

Author SHA1 Message Date
Louis Dionne 51358e45e2 [libcxx] Start defining lit features for tests depending on availability
This patch removes some vendor-specific availability XFAILs from the
test suite. In the future, when a new feature is introduced in the
dylib, an availability macro should be created and a matching lit
feature should be created. That way, the test suite can XFAIL whenever
the implementation lacks the necessary feature instead of being
cluttered by vendor-specific annotations.

Right now, those vendor-specific annotations are still somewhat cluttering
the test suite by being in `config.py`, but at least they are localized.
In the future, we could design a way to define those less intrusively or
even automatically based on the availability macros that already exist
in <__config>.

llvm-svn: 353201
2019-02-05 19:22:38 +00:00
Louis Dionne a3ec627a1c [libc++] Control whether exceptions are enabled in the macOS trunk testing script
llvm-svn: 353185
2019-02-05 16:42:37 +00:00
Louis Dionne b3b8968117 [NFC][libc++] Reindent function
llvm-svn: 353180
2019-02-05 15:46:52 +00:00
JF Bastien 73f499771f Fix double curlies
Pointed out by Arthur in D57624.

llvm-svn: 353140
2019-02-05 05:34:12 +00:00
Petr Hosek 3ad50fed48 [CMake] Update lit test configuration
There are several changes:
- Don't stringify Pythonized bools (that's why we're Pythonizing them)
- Support specifying target and sysroot via CMake variables
- Use consistent spelling for --target, --sysroot, --gcc-toolchain

llvm-svn: 353137
2019-02-05 04:44:03 +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
Petr Hosek 6fd4e7fe02 [CMake] Support CMake variables for setting target, sysroot and toolchain
CMake has a standard way of setting target triple, sysroot and external
toolchain through CMAKE_<LANG>_COMPILER_TARGET, CMAKE_SYSROOT and
CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN. These are turned into
corresponding --target=, --sysroot= and --gcc-toolchain= variables add
included appended to CMAKE_<LANG>_FLAGS.

libunwind, libc++abi, libc++ provides their own mechanism through
<PROJECT>_TARGET_TRIPLE, <PROJECT>_SYSROOT and <PROJECT>_GCC_TOOLCHAIN
variables. These are also passed to lit via lit.site.cfg, and lit config
uses these to set the corresponding compiler flags when building tessts.

This means that there are two different ways of setting target, sysroot
and toolchain, but only one is properly supported in lit. This change
extends CMake build for libunwind, libc++abi and libc++ to also support
the CMake variables in addition to project specific ones in lit.

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

llvm-svn: 353084
2019-02-04 20:02:26 +00:00
Eric Fiselier 508da4156a Move the feature test macros script to the utils directory.
It doesn't make a lot of sense to keep it with the tests,
deep into the test suite directonies.

llvm-svn: 352970
2019-02-02 23:13:49 +00:00
Eric Fiselier 1bccafe4f6 Handle cases where the dirent::d_type macros aren't defined
llvm-svn: 352942
2019-02-01 23:52:17 +00:00
Marshall Clow 2e719bc428 add a test and a couple minor bug fixes for the implicit-signed-integer-truncation sanitizer. This is PR#40566
llvm-svn: 352926
2019-02-01 21:59:27 +00:00
Louis Dionne 6b653fc70f [libc++] Disentangle the 3 implementations of type_info
Summary:
We currently have effectively 3 implementations of type_info: one for
the Microsoft ABI, one that does not assume that there's a unique copy
of each RTTI in a progran, and one that assumes a unique copy.

Those 3 implementations are entangled into the same class with nested
ifdefs, which makes it very difficult to understand. Furthermore, the
benefit of doing this is rather small since the code that is duplicated
across implementations is just a couple of trivial lines.

This patch stamps out the 3 versions of type_info explicitly to increase
readability. It also explains what's going on with short comments, because
it's far from obvious.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith

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

llvm-svn: 352905
2019-02-01 20:00:13 +00:00
Marshall Clow dd426c2fbd Fix a bit of libc++-specific behavior in the regex tests; add a missing test. Reviewed as https://reviews.llvm.org/D57391 Thanks to Andrey Maksimov for the patch
llvm-svn: 352781
2019-01-31 18:54:26 +00:00
Petr Hosek 8e78915446 [CMake] Use correct visibility for linked libraries in CMake
When linking library dependencies, we shouldn't need to export linked
libraries to dependents. We should be explicit about this in
target_link_libraries, otherwise other targets that depend on these such
as sanitizers get repeated (and possibly even conflicting) dependencies.

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

llvm-svn: 352688
2019-01-30 23:18:05 +00:00
Petr Hosek c0b3d36990 Revert "[CMake] Use correct visibility for linked libraries in CMake"
This reverts commit r352654: this broke libcxx and sanitizer bots.

llvm-svn: 352658
2019-01-30 19:51:18 +00:00
Petr Hosek b9128d8def [CMake] Use correct visibility for linked libraries in CMake
When linking library dependencies, we shouldn't need to export linked
libraries to dependents. We should be explicit about this in
target_link_libraries, otherwise other targets that depend on these such
as sanitizers get repeated (and possibly even conflicting) dependencies.

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

llvm-svn: 352654
2019-01-30 19:27:26 +00:00
Thomas Anderson 3663f26fb3 [libc++] Explicitly initialize std::nothrow
When building on Windows without libc++abi, this change fixes a build error of the form:

    src/new.cpp(38,17):  error: chosen constructor is explicit in copy-initialization
    const nothrow_t nothrow = {};
    include/vcruntime_new.h(53,22):  note: explicit constructor declared here
                explicit nothrow_t() = default;

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

llvm-svn: 352648
2019-01-30 19:09:41 +00:00
Thomas Anderson 13447450bc [libc++] Don't define operator new/delete when using vcruntime
Fixes build errors on Windows without libc++abi of the form:

    new(173,36):  error: redeclaration of 'operator delete' cannot add 'dllexport' attribute
    _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p) _NOEXCEPT;
    vcruntime_new.h(87,16):  note: previous declaration is here
    void __CRTDECL operator delete(
    new(205,70):  error: redefinition of 'operator new'
    _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new  (std::size_t, void* __p) _NOEXCEPT {return __p;}
    vcruntime_new.h(184,28):  note: previous definition is here
        inline void* __CRTDECL operator new(size_t _Size, _Writable_bytes_(_Size) void* _Where) noexcept
    new(206,70):  error: redefinition of 'operator new[]'
    _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
    vcruntime_new.h(199,28):  note: previous definition is here
        inline void* __CRTDECL operator new[](size_t _Size,
    new(207,40):  error: redefinition of 'operator delete'
    inline _LIBCPP_INLINE_VISIBILITY void  operator delete  (void*, void*) _NOEXCEPT {}
    vcruntime_new.h(190,27):  note: previous definition is here
        inline void __CRTDECL operator delete(void*, void*) noexcept
    new(208,40):  error: redefinition of 'operator delete[]'
    inline _LIBCPP_INLINE_VISIBILITY void  operator delete[](void*, void*) _NOEXCEPT {}
    vcruntime_new.h(206,27):  note: previous definition is here
        inline void __CRTDECL operator delete[](void*, void*) noexcept

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

llvm-svn: 352647
2019-01-30 19:08:32 +00:00
Thomas Anderson 095ed0554f [libc++] Don't define exception destructors when using vcruntime
Exception destructors are provided by vcruntime.  Fixes link errors like:

    lld-link: error: duplicate symbol: "public: virtual __cdecl std::invalid_argument::~invalid_argument(void)" (??1invalid_argument@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::length_error::~length_error(void)" (??1length_error@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::out_of_range::~out_of_range(void)" (??1out_of_range@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::overflow_error::~overflow_error(void)" (??1overflow_error@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)

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

llvm-svn: 352646
2019-01-30 19:07:30 +00:00
Thomas Anderson 7f50dfa6fc [libc++] Fix Windows build error in <functional>
On my Windows system, __allocator is defined to nothing.  This change fixes build errors of the below form:

    In file included from algorithm:644:
    functional(1492,31):  error: expected member name or ';' after declaration specifiers
        const _Alloc& __allocator() const { return __f_.second(); }

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

llvm-svn: 352561
2019-01-29 23:19:45 +00:00
Thomas Anderson db9152c248 [libc++] Fix Windows build error in include/filesystem
_LIBCPP_FUNC_VIS is redundant since the class is already annotated with
_LIBCPP_EXCEPTION_ABI.

Fixes this build error:

    In file included from fstream:188:
    filesystem(1350,3):  error: attribute 'dllimport' cannot be applied to member of 'dllimport' class
      _LIBCPP_FUNC_VIS
    __config(674,37):  note: expanded from macro '_LIBCPP_FUNC_VIS'
    #define _LIBCPP_FUNC_VIS            _LIBCPP_DLL_VIS
    __config(666,38):  note: expanded from macro '_LIBCPP_DLL_VIS'
    #  define _LIBCPP_DLL_VIS __declspec(dllimport)
    filesystem(1313,7):  note: previous attribute is here
    class _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error {
    __config(675,37):  note: expanded from macro '_LIBCPP_EXCEPTION_ABI'
    #define _LIBCPP_EXCEPTION_ABI       _LIBCPP_DLL_VIS
    __config(666,38):  note: expanded from macro '_LIBCPP_DLL_VIS'
    #  define _LIBCPP_DLL_VIS __declspec(dllimport)

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

llvm-svn: 352525
2019-01-29 18:48:35 +00:00
Eric Fiselier 011943a6e8 Fix PR40495 - is_invokable_v<void> does not compile
The meta-programming that attempted to form the invoke call expression
was not in a SFINAE context. This made it a hard error to provide
non-referencable types like 'void' or 'void (...) const'.

This patch fixes the error by checking the validity of the call
expression within a SFINAE context.

llvm-svn: 352522
2019-01-29 18:01:14 +00:00
James Y Knight 5d71fc5d7b Adjust documentation for git migration.
This fixes most references to the paths:
 llvm.org/svn/
 llvm.org/git/
 llvm.org/viewvc/
 github.com/llvm-mirror/
 github.com/llvm-project/
 reviews.llvm.org/diffusion/

to instead point to https://github.com/llvm/llvm-project.

This is *not* a trivial substitution, because additionally, all the
checkout instructions had to be migrated to instruct users on how to
use the monorepo layout, setting LLVM_ENABLE_PROJECTS instead of
checking out various projects into various subdirectories.

I've attempted to not change any scripts here, only documentation. The
scripts will have to be addressed separately.

Additionally, I've deleted one document which appeared to be outdated
and unneeded:
  lldb/docs/building-with-debug-llvm.txt

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

llvm-svn: 352514
2019-01-29 16:37:27 +00:00
Louis Dionne 6409d75698 [NFC] Add missing revision for removal of bad_array_length in ABI changelog
llvm-svn: 352513
2019-01-29 16:30:11 +00:00
Marshall Clow c02236b6f5 Mark some of the behavior in the move w/allocator constructors of deque/unordered containers as 'libc++-specific'. Thanks to Andrey Maksimov for pointing this out.
llvm-svn: 352512
2019-01-29 16:12:45 +00:00
Petr Hosek 4155e78912 [libc++] Use runtime rather then compile-time glibc version check
glibc supports versioning, so it's possible to build against older
version and run against newer version. This is sometimes relied on
in practice, e.g. in Fuchsia build we build against older sysroot
(equivalent to Ubuntu Trusty) to cover the broadest possible range
of host systems, but that doesn't necessarily match the system that
binary is going to run on which may have newer version, in which case
the compile test used in curr_symbol is going to fail. Using runtime
check is more reliable.

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

llvm-svn: 352425
2019-01-28 20:39:50 +00:00
Petr Hosek 12f4b86808 Revert "[CMake] Use __libc_start_main rather than fopen when checking for C library"
This reverts commit r352341: it broke the build on macOS which doesn't
seem to provide __libc_start_main in its C library.

llvm-svn: 352411
2019-01-28 19:26:41 +00:00
Michal Gorny d4b194cf95 [cmake] Fix get_llvm_lit_path() to respect LLVM_EXTERNAL_LIT always
Refactor the get_llvm_lit_path() logic to respect LLVM_EXTERNAL_LIT,
and require the fallback to be defined explicitly
as LLVM_DEFAULT_EXTERNAL_LIT. This fixes building libcxx standalone
after r346888.

The old logic was using LLVM_EXTERNAL_LIT both as user-defined cache
variable and an optional pre-definition of default value from caller
(e.g. libcxx). It included a hack to make this work by assigning
the value back and forth but it was fragile and stopped working
in libcxx.

The new logic is simpler and more transparent. Default value is
provided in a separate variable, and used only when user-specified
variable is empty (i.e. not overriden).

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

llvm-svn: 352374
2019-01-28 15:16:03 +00:00
Petr Hosek b667153cf6 [CMake] Use __libc_start_main rather than fopen when checking for C library
The check_library_exists CMake uses a custom symbol definition. This
is a problem when checking for C library symbols because Clang
recognizes many of them as builtins, and returns the
-Wbuiltin-requires-header (or -Wincompatible-library-redeclaration)
error. When building with -Werror which is the default, this causes
the check_library_exists check fail making the build think that C
library isn't available.

To avoid this issue, we should use a symbol that isn't recognized by
Clang and wouldn't cause the same issue. __libc_start_main seems like
reasonable choice that fits the bill.

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

llvm-svn: 352341
2019-01-28 04:12:54 +00:00
Eric Fiselier d258c80414 update upcoming meeting issue status
llvm-svn: 352339
2019-01-28 02:59:01 +00:00
Kamil Rytarowski 7c56f115b4 Mark awk.pass.cpp as XFAIL for NetBSD
Reported on the NetBSD 8 build bot.

llvm-svn: 352097
2019-01-24 20:26:02 +00:00
Marshall Clow 5a8525e0b6 D14686: 'Protect against overloaded comma in random_shuffle and improve tests' I had to cut back on the tests with this, because they were not C++03 friendly. Thanks to gribozavr for the patch
llvm-svn: 352087
2019-01-24 19:20:19 +00:00
Louis Dionne c43f673090 [libcxx] Portability fix: unordered_set and unordered_multiset iterators are not required to be the same
The unordered_set and unordered_multiset iterators are specified in the standard as follows:

using iterator             = implementation-defined; // see [container.requirements]
using const_iterator       = implementation-defined; // see [container.requirements]
using local_iterator       = implementation-defined; // see [container.requirements]
using const_local_iterator = implementation-defined; // see [container.requirements]

The pairs iterator/const_iterator and local_iterator/const_local_iterator
are not required to be the same. The reasonable requirement would be that
iterator can convert to const_iterator and local_iterator can convert to
const_local_iterator. This patch weakens the check and makes the test
more portable.

Reviewed as https://reviews.llvm.org/D56493.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 352083
2019-01-24 19:09:22 +00:00
Kamil Rytarowski 47c0eb2bc2 Mark another test as flaky
Reported on the NetBSD 8 buildbot.

llvm-svn: 352064
2019-01-24 17:17:55 +00:00
Marshall Clow 6973bb06d9 Change a couple of '&' to addressof(). NFC
llvm-svn: 352007
2019-01-24 02:02:50 +00:00
Marshall Clow f6b6be2f7a Uncomment the entire test, but mark as XFAIL on linux-gnu because it uses locales that aren't generally available there, similar to the other regex tests
llvm-svn: 352006
2019-01-24 01:52:56 +00:00
Kamil Rytarowski d3068a2c2f Mark another test as flaky
Reported on the NetBSD 8 buildbot.

llvm-svn: 351995
2019-01-23 23:24:43 +00:00
Marshall Clow 28166dd9b3 Apply D28248: 'Work around GCC PR37804'. Thanks to mdaniels for the patch
llvm-svn: 351993
2019-01-23 23:06:18 +00:00
Casey Carter 1ecf6e55cd [test] Define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST in msvc_stdlib_force_include.hpp
...so the tests under test/std/utilities/any continue to
compile with MSVC's standard library.

While we're here, let's test >C++17 features when _HAS_CXX20.

llvm-svn: 351991
2019-01-23 22:49:44 +00:00
Kamil Rytarowski 829d916d7d Mark another test as flaky
Reported on the NetBSD 8 buildbot.

llvm-svn: 351988
2019-01-23 22:35:57 +00:00
Kamil Rytarowski 314bd26db1 Correct mark for flaky tests
Add missing trailing dot.

llvm-svn: 351983
2019-01-23 21:45:02 +00:00
Marshall Clow 8681a3bc85 Commit D11348: 'Win32 support: wcsnrtombs and mbsnrtowcs don't handle null output buffers correctly' which has been hanging around for a long time
llvm-svn: 351971
2019-01-23 18:27:22 +00:00
Kamil Rytarowski 776cf71d4f Mark more tests flaky
Reported on the NetBSD 8 buildbot

llvm-svn: 351944
2019-01-23 11:36:19 +00:00
Kamil Rytarowski fe1991b55e Mark thread.condition.condvarany/wait_for.pass.cpp as flaky
Reported on the NetBSD 8 buildbot.

llvm-svn: 351937
2019-01-23 10:11:41 +00:00
Marshall Clow 8f302e6222 While reviewing D57058, Louis had some questions about the existing span constructor tests. They were not testing the stuff that they said they were. Updated the tests to test what they should have been doing
llvm-svn: 351887
2019-01-22 22:01:13 +00:00
Louis Dionne 53e8ece06a [libcxx] Include <cstring> in tests that use strcmp
Reviewed as https://reviews.llvm.org/D56503.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 351847
2019-01-22 17:45:00 +00:00
Marshall Clow 03ed93fd37 Note that we have a patch for LWG3101
llvm-svn: 351832
2019-01-22 16:22:53 +00:00
Marshall Clow 9846f5f792 Updated issue 3144
llvm-svn: 351773
2019-01-22 01:05:58 +00:00
Marshall Clow c09219363c Update with issues to be moved in San Diego
llvm-svn: 351770
2019-01-22 00:31:09 +00:00
Chandler Carruth 4a1b95bda0 Fix typos throughout the license files that somehow I and my reviewers
all missed!

Thanks to Alex Bradbury for pointing this out, and the fact that I never
added the intended `legacy` anchor to the developer policy. Add that
anchor too. With hope, this will cause the links to all resolve
successfully.

llvm-svn: 351731
2019-01-21 09:52:34 +00:00
Eric Fiselier 85bdbbf9a1 Fix aligned allocation availability XFAILs after D56445.
D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

llvm-svn: 351670
2019-01-20 01:21:35 +00:00
Eric Fiselier 3662572275 Revert "Fix aligned allocation availability XFAILs after D56445."
This reverts commit r351625.

That fix was incomplete. I'm reverting so I can commit a complete fix
in a single revision.

llvm-svn: 351669
2019-01-20 01:12:53 +00:00
Eric Fiselier b0f1013a73 Improve docker images and configuration; create compiler-zoo image
llvm-svn: 351667
2019-01-19 23:36:06 +00:00
Chandler Carruth bd9dafecf7 Update an example to use the new LLVM file header.
llvm-svn: 351653
2019-01-19 11:54:04 +00:00
Chandler Carruth b3ee4190e7 Update generator script to use the new license file header.
llvm-svn: 351650
2019-01-19 11:38:40 +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
Eric Fiselier 8c0332204d Fix all the bots.
The buildbot start scripts hardcode the version string.
Bump it from 8 to 9.

llvm-svn: 351638
2019-01-19 09:07:04 +00:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

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: 351636
2019-01-19 08:50:56 +00:00
Chandler Carruth 469bdefd44 Install new LLVM license structure and new developer policy.
This installs the new developer policy and moves all of the license
files across all LLVM projects in the monorepo to the new license
structure. The remaining projects will be moved independently.

Note that I've left odd formatting and other idiosyncracies of the
legacy license structure text alone to make the diff easier to read.
Critically, note that we do not in any case *remove* the old license
notice or terms, as that remains necessary until we finish the
relicensing process.

I've updated a few license files that refer to the LLVM license to
instead simply refer generically to whatever license the LLVM project is
under, basically trying to minimize confusion.

This is really the culmination of so many people. Chris led the
community discussions, drafted the policy update and organized the
multi-year string of meeting between lawyers across the community to
figure out the strategy. Numerous lawyers at companies in the community
spent their time figuring out initial answers, and then the Foundation's
lawyer Heather Meeker has done *so* much to help refine and get us ready
here. I could keep going on, but I just want to make sure everyone
realizes what a huge community effort this has been from the begining.

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

llvm-svn: 351631
2019-01-19 06:14:24 +00:00
Eric Fiselier a32dd04238 Fix aligned allocation availability XFAILs after D56445.
D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

llvm-svn: 351625
2019-01-19 03:27:05 +00:00
Eric Fiselier 0e997efd53 [hurd] Fix unconditional use of PATH_MAX
Patch by Samuel Thibault

The GNU/Hurd system does not define an arbitrary PATH_MAX limitation, the POSIX 2001 realpath
extension can be used instead, and the size of symlinks can be determined.

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

llvm-svn: 351414
2019-01-17 02:59:28 +00:00
Hans Wennborg 1fe469ae6c Bump the trunk version to 9.0.0svn
llvm-svn: 351320
2019-01-16 10:57:02 +00:00
Eric Fiselier 973eab8a5d correct script name in generated tests
llvm-svn: 351299
2019-01-16 05:43:02 +00:00
Eric Fiselier efdac65f70 Attempt to make test_macros.h even more minimal
llvm-svn: 351292
2019-01-16 02:16:57 +00:00
Eric Fiselier 05019eb79f Fix feature test macros for atomics/mutexes without threading
llvm-svn: 351291
2019-01-16 02:10:28 +00:00
Eric Fiselier d01a4aa068 Fix PR40230 - std::pair may have padding on FreeBSD.
Summary:
FreeBSD ships a very old and deprecated ABI for std::pair where the copy and move constructors are not allowed to be trivial. D25389 change how this was implemented by introducing a non-trivial base class. This patch, introduced in October 2016, introduced an ABI bug that caused nested `std::pair` instantiations to have padding. For example:

```
using PairT = std::pair< std::pair<char, char>, char >;
static_assert(offsetof(PairT, first) == 0, "First member should exist at offset zero"); // Fails on FreeBSD!
```

The bug occurs because the base class for the first element (the nested pair) cannot be put at offset zero because the top-level pair already has the same base class laid out there.

This patch fixes that ABI bug by templating the dummy base class on the same parameters as the pair.

Technically this fix is an ABI break for users who depend on the "broken" ABI introduced in 2016. I'm putting this up for review so that the FreeBSD maintainers can sign off on fixing the ABI by breaking the ABI.
Another option, since we have to "break" the ABI to fix it, would be to move FreeBSD off the deprecated non-trivial pair ABI instead.

Also see:

* https://llvm.org/PR40230
* https://reviews.llvm.org/D21329



Reviewers: rsmith, dim, emaste

Reviewed By: rsmith

Subscribers: mclow.lists, krytarowski, christof, ldionne, libcxx-commits

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

llvm-svn: 351290
2019-01-16 01:54:34 +00:00
Eric Fiselier d108bf85b0 Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.
Summary:
Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See  llvm.org/PR39713

This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used.

This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement.

I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. 

Reviewers: ldionne, EricWF

Reviewed By: ldionne, EricWF

Subscribers: jyknight, christof, libcxx-commits

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

llvm-svn: 351289
2019-01-16 01:51:12 +00:00
Eric Fiselier 32784a740a Implement feature test macros using a script.
Summary:
This patch implements all the feature test macros libc++ currently supports, as specified by the standard or cppreference prior to C++2a.

The tests and `<version>` header are generated using a script. The script contains a table of each feature test macro, the headers it should be accessible from, and its values of each dialect of C++.
When a new feature test macro is added or needed, the table should be updated and the script re-run.



Reviewers: mclow.lists, jfb, serge-sans-paille

Reviewed By: mclow.lists

Subscribers: arphaman, jfb, ldionne, libcxx-commits

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

llvm-svn: 351286
2019-01-16 01:37:43 +00:00
Dan Albert 45b511fb05 Fix size_t/off_t mixup in std::filesystem.
Summary: ftruncate takes an off_t, not a size_t.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: christof, ldionne, libcxx-commits

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

llvm-svn: 351226
2019-01-15 19:16:25 +00:00
Dan Albert 5452d3f099 Add large file support to create_file for 32-bit.
Summary:
The tests need to create files larger than 2GB, but size_t is 32-bit
on a 32-bit system. Make use of explicit off64_t APIs so we can still
use a default off_t for the tests while enabling 64-bit file offsets
for create_file.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: christof, ldionne, libcxx-commits

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

llvm-svn: 351225
2019-01-15 19:14:15 +00:00
Petr Hosek 20c425cdab [libc++] Support different libc++ namespaces in the iterator test
libc++ allows changing the namespace, don't assume __1 in the test
to avoid the test failure if different namespace is being used.

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

llvm-svn: 351220
2019-01-15 18:55:55 +00:00
Hans Wennborg eb60fbfdb4 Update year in license files
In last year's update (D48219) it was suggested that the release manager
might want to do this, so here we go.

llvm-svn: 351194
2019-01-15 15:10:32 +00:00
Casey Carter dcaaa1baed [test] Fix logic error in <compare> tests; enable for MSVC Dev16
Submitted upstream as https://reviews.llvm.org/D53763.

llvm-svn: 351148
2019-01-15 01:53:12 +00:00
Marshall Clow f3126c8bc5 Generalize the comparison test structure to support cross-type comparisons. NFC to the library
llvm-svn: 351140
2019-01-15 00:05:05 +00:00
Petr Hosek 2fefe153dd [libcxx] Mark do_open, do_get and do_close parameters unused when catopen is missing
When catopen is missing, do_open, do_get and do_close end up being
no-op, and as such their parameters will be unused which triggers a
warning/error when building with -Wunused-parameter.

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

llvm-svn: 351027
2019-01-13 22:15:37 +00:00
Marshall Clow e495760140 Change from a to a . Fixes PR#39871.
llvm-svn: 350972
2019-01-11 21:57:12 +00:00
Adhemerval Zanella 63ea958521 [libcxx] Call __count_bool_true for bitset count
This patch aims to help clang with better information so it can inline
__bit_reference count function usage for both std::biset. Current clang
inliner can not infer that the passed typed will be used only to select
the optimized variant, it evaluates the type argument and type check as
a load plus compare (although later optimization phases correctly
optimized this out).

It is mainly to help llvm inliner to generate better code for std::bitset
count for aarch64. It helps on both runtime and code size, since if inline
decides that _VSTD::count should not be inlined the vectorization will
create both aligned and unaligned variants (which add both code size and
runtime costs)

llvm-svn: 350936
2019-01-11 17:31:17 +00:00
Marshall Clow 80378fd38b Don't use the form '2017y' in tests, since some gcc versions don't allow it
llvm-svn: 350930
2019-01-11 15:45:56 +00:00
Marshall Clow 5c08881343 Implement the 'sys_time' portions of the C++20 calendaring stuff. Reviewed as D56494
llvm-svn: 350929
2019-01-11 15:12:04 +00:00
Louis Dionne 1d5f6a81f5 [libcxx] Reorganize tests since the application of P0602R4
Summary:
P0602R4 makes the special member functions of optional and variant
conditionally trivial based on the types in the optional/variant.
We already implemented that, but the tests were organized as if this
were a non-standard extension. This patch reorganizes the tests in a
way that makes more sense since this is not an extension anymore.

Reviewers: EricWF, mpark, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 350884
2019-01-10 20:06:11 +00:00
JF Bastien a936f84863 Filesystem tests: fix fs.op.relative
Summary: The test wasn't using the testing infrastructure properly.

Reviewers: ldionne, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 350872
2019-01-10 18:50:34 +00:00
JF Bastien 1026ce6de4 [NFC] Always lock free test: add indirection
I have a big patch coming up, and this indirection is required to avoid hitting the following after my big change:

  error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat]

llvm-svn: 350772
2019-01-09 23:20:24 +00:00
JF Bastien 2f4df4c986 [NFC] Normalize some test 'main' signatures
There were 3 tests with 'int main(void)', and 6 with the return type on a different line. I'm about to send a patch for main in tests, and this NFC change is unrelated.

llvm-svn: 350770
2019-01-09 22:56:45 +00:00
Louis Dionne 227371ded6 [libcxx] Add a script to run CI on older MacOS versions
This script can be used by CI systems to test things like availability
markup and binary compatibility on older MacOS versions. This is still
a bit rough on the edges, for example we don't test libc++abi yet.

llvm-svn: 350752
2019-01-09 19:40:20 +00:00
Louis Dionne cb4e59ed92 [libcxx] Add a script to run CI on MacOS
CI systems like Green Dragon should use this script so as to make
reproducing errors easy locally.

llvm-svn: 350740
2019-01-09 16:35:55 +00:00
Eric Fiselier e49fc07c69 Mark two UDL tests as being unsupported with Clang 7
llvm-svn: 350739
2019-01-09 16:34:17 +00:00
Louis Dionne ea443cf828 [libcxx] Remove outdated XFAILs for aligned deallocation
AppleClang 10 has been fixed and so these tests don't fail anymore.

llvm-svn: 350736
2019-01-09 16:13:04 +00:00
Eric Fiselier 7b03b66e5c Mark two more tests as FLAKY
llvm-svn: 350692
2019-01-09 05:48:54 +00:00
Louis Dionne 4d3366e257 [Sema] Teach Clang that aligned allocation is not supported with macosx10.13
Summary:
r306722 added diagnostics when aligned allocation is used with deployment
targets that do not support it, but the first macosx supporting aligned
allocation was incorrectly set to 10.13. In reality, the dylib shipped
with macosx10.13 does not support aligned allocation, but the dylib
shipped with macosx10.14 does.

Reviewers: ahatanak

Subscribers: christof, jkorous, dexonsmith, cfe-commits

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

llvm-svn: 350649
2019-01-08 20:26:56 +00:00
Marshall Clow 8f9346922c Set the buffer of an fstream to empty when the underlying file is closed. This 'fixes' PR#38052 - std::fstream still good after closing and updating content.
llvm-svn: 350603
2019-01-08 02:48:45 +00:00
Volodymyr Sapsai fb0e1908d4 [libcxx] Optimize vectors construction of trivial types from an iterator range with const-ness mismatch.
We already have a specialization that will use memcpy for construction
of trivial types from an iterator range like

    std::vector<int>(int *, int *);

But if we have const-ness mismatch like

    std::vector<int>(const int *, const int *);

we would use a slow path that copies each element individually. This change
enables the optimal specialization for const-ness mismatch. Fixes PR37574.

Contributions to the patch are made by Arthur O'Dwyer, Louis Dionne.

rdar://problem/40485845

Reviewers: mclow.lists, EricWF, ldionne, scanon

Reviewed By: ldionne

Subscribers: christof, ldionne, howard.hinnant, cfe-commits

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

llvm-svn: 350583
2019-01-08 00:03:16 +00:00
Eric Fiselier 389da901d0 Mark more tests as flaky
llvm-svn: 350550
2019-01-07 18:21:18 +00:00
Marshall Clow 4d4213f694 Add the feature test macros that were defined in p1353r0 to the headers of the appropriate tests. No actual tests yet, so NFC.
llvm-svn: 350535
2019-01-07 16:17:52 +00:00
Petr Hosek a2685cd6dc [libcxx] Support building hermetic static library
This is useful when static libc++ library is being linked into
shared libraries that may be used in combination with libraries.
We want to avoid we exporting libc++ symbols in those cases where
this option is useful. This is provided as a CMake option and can
be enabled by libc++ vendors as needed.

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

llvm-svn: 350489
2019-01-06 06:14:31 +00:00
Eric Fiselier b168a7c660 Fix PR39749 - Headers containing just #error harm __has_include.
This patch changes <experimental/foo> to use #warning instead of
is harmful to common feature detection idioms.

We should also consider only emitting the warning when __DEPRECATED is
defined, like we do in the <ext/foo> headers. Users may want to specify
"-Werror=-W#warnings" while still ignoring the libc++ warnings.

llvm-svn: 350485
2019-01-06 00:37:31 +00:00
Eric Fiselier 5792cf42b7 Fix flaky symlink access time test.
last_write_time(sym, new_time) changes the modification time of the file
referenced by the symlink. But reading through the symlink may change the
symlinks's access time.

This meant the previous test that checked that the symlinks access
time was unchanged was incorrect and made the test flaky.

This patch removes this test (there really is no non-flaky way
to test that the new access time coorisponds to the time at which
the symlink was last dereferenced). This should unflake the test.

llvm-svn: 350478
2019-01-05 21:18:10 +00:00
Kamil Rytarowski 74b936ec98 Revert "D56064: More tolerance for flaky tests in libc++ on NetBSD"
Requested by EricWF.

llvm-svn: 350477
2019-01-05 20:11:54 +00:00
Marshall Clow 71c1680d2c De-tab a couple tests. NFC
llvm-svn: 350330
2019-01-03 17:18:40 +00:00
Kamil Rytarowski 2803bcf5b0 More tolerance for flaky tests in libc++ on NetBSD
Summary:
Tests marked with the flaky attribute ("FLAKY_TEST.")
can still report false positives in local tests and on the
NetBSD buildbot.

Additionally a number of tests (probably all threaded
ones) unmarked with the flaky attribute is flaky on
NetBSD.

An ideal solution on the libcxx side would be to raise
max retries for NetBSD and mark failing tests with
the flaky flag, however this adds more maintenance
burden and constant monitoring of flaky tests.

Reduce the work and handle flaky tests as more flaky
on NetBSD and allow flakiness  of other tests on
NetBSD.

Reviewers: mgorny, EricWF

Reviewed By: mgorny

Subscribers: christof, llvm-commits, libcxx-commits

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

llvm-svn: 350170
2018-12-30 23:05:14 +00:00
Louis Dionne 9f3561c292 [libcxx] Remove unused macro _LIBCPP_HAS_UNIQUE_TYPEINFO
Summary:
We already have the negation of that as _LIBCPP_HAS_NONUNIQUE_TYPEINFO.
Having both defined is confusing, since only one of them is used.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 349947
2018-12-21 20:14:43 +00:00
Louis Dionne 5517aa6172 [NFC] Fix typo in comment
llvm-svn: 349932
2018-12-21 17:32:23 +00:00
Eric Fiselier aae39bf928 Fix test case breakages caused by lexically_relative change
llvm-svn: 349888
2018-12-21 04:38:22 +00:00
Eric Fiselier 8c0c8e154b Don't forward declare _FilesystemClock in C++03
llvm-svn: 349887
2018-12-21 04:30:04 +00:00
Eric Fiselier 8b1ad5cf8d Fix copy paste error in file_clock tests
llvm-svn: 349886
2018-12-21 04:27:45 +00:00
Eric Fiselier ba62831f7c Implement LWG 3096: path::lexically_relative is confused by trailing slashes
path("/dir/").lexically_relative("/dir"); now returns "." instead of ""

llvm-svn: 349885
2018-12-21 04:25:40 +00:00
Eric Fiselier 49b183a9ec Implement LWG 3065: Make path operators friends.
This prevents things like:

using namespace std::filesystem;
auto x = L"a/b" == std::string("a/b");

llvm-svn: 349884
2018-12-21 04:09:01 +00:00
Eric Fiselier 866885e12a Implement LWG 3145: file_clock breaks ABI for C++17 implementations.
This patch adds std::chrono::file_clock, but without breaking the
existing ABI for std::filesystem.

llvm-svn: 349883
2018-12-21 03:54:57 +00:00
Eric Fiselier 1425485773 Implement LWG 2936: Path comparison is defined in terms of the generic format
This patch implements path::compare according to the current spec. The
only observable change is the ordering of "/foo" and "foo", which orders
the two paths based on having or not having a root directory (instead
of lexically comparing "/" to "foo").

llvm-svn: 349881
2018-12-21 03:16:30 +00:00
Eric Fiselier 5763cbb426 Mark two filesystem LWG issues as complete - nothing to do
llvm-svn: 349877
2018-12-21 02:17:00 +00:00
Louis Dionne ebc2344a8b [libcxx] Fix order checking in unordered_multimap tests.
Some tests assume that iteration through an unordered multimap elements
will return them in the same order as at the container creation. This
assumption is not true since the container is unordered, so that no
specific order of elements is ever guaranteed for such container. This
patch introduces checks verifying that any iteration will return elements
exactly from a set of valid values and without repetition, but in no
particular order.

Reviewed as https://reviews.llvm.org/D54838.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 349780
2018-12-20 17:55:31 +00:00
Volodymyr Sapsai e7652f5c0d [libcxx] Use custom allocator's `construct` in C++03 when available.
Makes libc++ behavior consistent between C++03 and C++11.

Can use `decltype` in C++03 because `include/__config` defines a macro when
`decltype` is not available.

Reviewers: mclow.lists, EricWF, erik.pilkington, ldionne

Reviewed By: ldionne

Subscribers: dexonsmith, cfe-commits, howard.hinnant, ldionne, christof, jkorous, Quuxplusone

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

llvm-svn: 349676
2018-12-19 20:08:43 +00:00
Eric Fiselier 350ee4bb13 Work around GCC 9.0 regression
llvm-svn: 349663
2018-12-19 18:58:22 +00:00
Marshall Clow 8d221b40a7 Add missing include to test. NFC
llvm-svn: 349639
2018-12-19 16:39:04 +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
Louis Dionne c19d729786 [libcxx] Remove XFAILs for older macOS versions
That test doesn't fail anymore since r349378, since the assertions that
r349378 removed must have been bugs in the dylib at some point.

llvm-svn: 349484
2018-12-18 13:46:28 +00:00
Louis Dionne 06caa6d2e6 [libcxx] Handle AppleClang 9 and 10 in XFAILs for aligned allocation tests
I forgot that those don't behave like Clang trunk, again.

llvm-svn: 349427
2018-12-18 00:42:09 +00:00
Louis Dionne afb1d72e7b [libcxx] Properly mark aligned allocation macro test as XFAIL on OS X
This test was initially marked as XFAIL using `XFAIL: macosx10.YY`, and
was then moved to `UNSUPPORTED: macosx10.YY`. The intent is to mark the
test as XFAILing when a deployment target older than macosx10.14 is used,
and the right way to do this is `XFAIL: availability=macosx10.YY`.

llvm-svn: 349426
2018-12-18 00:30:15 +00:00
Louis Dionne c8ca4d8cc1 [libcxx][NFC] Properly indent nested #ifdefs and #defines
I just realized I had always been reading this wrong because of the lack
of indentation, so I'm re-indenting this properly.

llvm-svn: 349408
2018-12-17 22:22:44 +00:00
Eric Fiselier 2a58b11a8a Fix FP comparisons when SSE isn't available
llvm-svn: 349387
2018-12-17 20:17:43 +00:00
Michal Gorny c32d47c6a8 [test] Add target_info for NetBSD, and XFAIL some of locale tests
Add a target_info definition for NetBSD.  The definition is based
on the one used by FreeBSD, with libcxxrt replaced by libc++abi,
and using llvm-libunwind since we need to use its unwinder
implementation to build anyway.

Additionally, XFAIL the 30 tests that fail because of non-implemented
locale features.  According to the manual, NetBSD implements only
LC_CTYPE part of locale handling.  However, there is a locale database
in the system and locale specifications are validated against it,
so it makes sense to list the common locales as supported.

If I'm counting correctly, this change enables additional 43 passing
tests.

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

llvm-svn: 349379
2018-12-17 19:14:08 +00:00
Michal Gorny 916bf993a2 [test] [re.traits] Remove asserts failing due to invalid UTF-8
Remove the two test cases for \xDA and \xFA with UTF-8 locale, as both
characters alone are invalid in UTF-8 (short sequences).  Upon removing
them, the test passes on Linux again (and also on NetBSD, after adding
appropriate locale configuration).

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

llvm-svn: 349378
2018-12-17 19:13:41 +00:00
Eric Fiselier 077a0aff16 Unbreak green dragon bots w/o __builtin_launder
llvm-svn: 349373
2018-12-17 18:37:59 +00:00
Eric Fiselier 2d6833c9c9 Expect Clang diagnostics in std::launder test
llvm-svn: 349364
2018-12-17 16:56:24 +00:00
Louis Dionne 04695a7539 [libcxx] Speeding up partition_point/lower_bound/upper_bound
This is a re-application of r345525, which had been reverted by fear of
a regression.

Reviewed as https://reviews.llvm.org/D53994.
Thanks to Denis Yaroshevskiy for the patch.

llvm-svn: 349358
2018-12-17 16:04:39 +00:00
Michal Gorny 4ce222198c [test] [support] Use socket()+bind() to create unix sockets portably
Replace the mknod() call with socket() + bind() for creating unix
sockets.  The mknod() method is not portable and does not work
on NetBSD while binding the socket should work on all systems supporting
unix sockets.

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

llvm-svn: 349305
2018-12-16 15:12:06 +00:00
Michal Gorny 16b9decb93 [test] [ctime] Ignore -Wformat-zero-length warnings
Explicitly disable the -Wformat-zero-length diagnostic when running
ctime tests, since one of the test cases passes zero-length format
string to strftime().  When strftime() is appropriately decorated
with __attribute__(format, ...), this caused the test to fail because
of this warning (e.g. on NetBSD).

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

llvm-svn: 349294
2018-12-16 09:18:31 +00:00
Michal Gorny a25cd0c2da [regex] Use distinct __regex_word on NetBSD
NetBSD defines character classes up to 0x2000.  Use 0x8000 as a safe
__regex_word that hopefully will not collide with other values
in the foreseeable future.

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

llvm-svn: 349293
2018-12-16 09:18:26 +00:00
Eric Fiselier 241c73b191 Fix static assert diagnostic checks in i386
llvm-svn: 349252
2018-12-15 05:18:56 +00:00
Eric Fiselier f707738557 Try 2: Fix bug in buildbot start script
llvm-svn: 349236
2018-12-15 03:48:08 +00:00
Eric Fiselier 6d7331c172 Fix bug in buildbot start script
llvm-svn: 349235
2018-12-15 03:45:21 +00:00
Eric Fiselier 4e903a3a7d Rework docker setup to make it easier to work around bugs on buildbots
llvm-svn: 349234
2018-12-15 03:24:33 +00:00
Eric Fiselier 3e5d847fa0 Tolerate Clangs new static_assert messages
llvm-svn: 349189
2018-12-14 20:42:36 +00:00
Louis Dionne a5e2b081be [libcxx] Mark some tests as still failing on macosx10.14
llvm-svn: 349187
2018-12-14 20:22:44 +00:00
Marshall Clow cac3d118ae When resolving a merge conflict, I put something inside an #ifdef. Fixed.
llvm-svn: 349181
2018-12-14 19:25:22 +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 bc297b1da9 [libcxx] Make sure use_system_cxx_lib does not override cxx_runtime_root for DYLD_LIBRARY_PATH
Otherwise, even specifying a runtime root different from the library
we're linking against won't work -- the library we're linking against
is always used. This is undesirable if we try testing something like
linking against a recent libc++.dylib but running the tests against an
older version (the back-deployment use case).

llvm-svn: 349171
2018-12-14 18:19:14 +00:00
Eric Fiselier 814715f958 Update google benchmark again
llvm-svn: 349127
2018-12-14 03:48:09 +00:00
Eric Fiselier 7a91ac4753 Update google benchmark version
llvm-svn: 349126
2018-12-14 03:37:13 +00:00
Thomas Anderson 1cffc38485 [libc++] Fix _LIBCPP_EXPORTED_FROM_ABI when visibility annotations are disabled
Fixes a bug where functions would get exported when building with
-fvisibility=hidden and defining _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS. No
visibility annotations should be added in this case.

The new logic for _LIBCPP_EXPORTED_FROM_ABI matches that of the other visibility
annotations around it.

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

llvm-svn: 349080
2018-12-13 20:06:14 +00:00
Louis Dionne 5f1706f3aa [libcxx] Fix pop_back() tests to make sure they don't always just pass
llvm-svn: 349071
2018-12-13 18:53:17 +00:00
Louis Dionne 589f1764fc [libcxx] Add assertion in deque::pop_back when popping from an empty deque
Also, add tests making sure that vector and deque both catch the problem
when assertions are enabled. Otherwise, deque would segfault and vector
would never terminate.

llvm-svn: 348994
2018-12-12 23:58:25 +00:00
Michal Gorny 68cbd6bdb2 [test] [depr.c.headers] XFAIL uchar.h on NetBSD
llvm-svn: 348973
2018-12-12 20:51:46 +00:00
Michal Gorny c22e62d9a7 [test] [filesystems] NetBSD can do symlink permissions too
llvm-svn: 348968
2018-12-12 20:28:52 +00:00
Michal Gorny e8e635ff5e [test] [filesystems] Extend FreeBSD tv_sec==-1 workaround to NetBSD
NetBSD also uses tv_sec==-1 as error status indicator, and does not
support setting such a value.

llvm-svn: 348967
2018-12-12 20:20:15 +00:00
Michal Gorny 97569391ea [test] Permit NetBSD in filesystem_dynamic_test_helper.py
llvm-svn: 348872
2018-12-11 18:29:35 +00:00
Louis Dionne 471b8b73c9 [libcxx] Only enable the availability LIT feature when we're testing libc++
Other standard libraries don't implement availability markup, so it doesn't
make sense to e.g. XFAIL tests based on availability markup outside of
libc++.

llvm-svn: 348871
2018-12-11 18:05:38 +00:00
Louis Dionne 2112fbcc00 [libcxx] Remove the no_default_flags LIT configuration
This is part of an ongoing cleanup of the LIT test suite, where I'm
trying to reduce the number of configuration options. In this case,
the original intent seemed to be running the test suite with libstdc++,
but this is now supported by specifying cxx_stdlib_under_test=libstdc++.

llvm-svn: 348868
2018-12-11 17:29:55 +00:00
Louis Dionne edc36c0731 [NFC] Fix incorrect (but unreachable) LIT error message
It is unreachable because we test that the cxx_stdlib_under_test is
in the supported set of libraries elsewhere. Furthermore, this code
relied on the `use_stdlib_type`, which is never defined.

llvm-svn: 348867
2018-12-11 17:05:20 +00:00
Louis Dionne 17b65c0d58 [libcxx] Fix test failure on GCC 4.9
GCC 4.9 seems to think that a constexpr default constructor implies
the constructor to be noexcept.

llvm-svn: 348850
2018-12-11 15:27:10 +00:00
Louis Dionne 9f77b1a1de [pair] Mark constructors as conditionally noexcept
Summary:
std::tuple marks its constructors as noexcept when the corresponding
memberwise constructors are noexcept too -- this commit improves std::pair
so that it behaves the same.

This is a re-application of r348824, which broke the build in C++03 mode
because a test was marked as supported in C++03 when it shouldn't be.

Note:
I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
constructors because those are non-standard extensions, and supporting them
properly is tedious (we have to copy the rvalue-referenceness of the deduced
_Tuple&& onto the result of tuple_element).

<rdar://problem/29537079>

Reviewers: mclow.lists, EricWF

Subscribers: christof, llvm-commits

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

llvm-svn: 348847
2018-12-11 14:22:28 +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
Louis Dionne d5a20703c4 Revert "[pair] Mark constructors as conditionally noexcept"
This broke the tests on Linux. Reverting until I find out why the tests
are broken (tomorrow).

llvm-svn: 348825
2018-12-11 02:32:46 +00:00
Louis Dionne 76cce3b2bd [pair] Mark constructors as conditionally noexcept
Summary:
std::tuple marks its constructors as noexcept when the corresponding
memberwise constructors are noexcept too -- this commit improves std::pair
so that it behaves the same.

Note:
I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
constructors because those are non-standard extensions, and supporting them
properly is tedious (we have to copy the rvalue-referenceness of the deduced
_Tuple&& onto the result of tuple_element).

<rdar://problem/29537079>

Reviewers: mclow.lists, EricWF

Subscribers: christof, llvm-commits

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

llvm-svn: 348824
2018-12-11 02:17:23 +00:00
Eric Fiselier 08e231dd9c Add a version of std::function that includes a few optimizations in ABI V2.
Patch by Jordan Soyke (jsoyke@google.com)
Reviewed as D55045

The result of running the benchmarks and comparing them can be found
here: https://gist.github.com/EricWF/a77fd42ec87fc98da8039e26d0349498

llvm-svn: 348812
2018-12-11 00:14:34 +00:00
Eric Fiselier 5f503b47cb Refactor std::function to more easily support alternative implementations.
Patch from Jordan Soyke (jsoyke@google.com)
Reviewed as D55520

This change adds a new internal class, called __value_func, that adds
a minimal subset of value-type semantics to the internal __func interface.

The change is NFC, and is cleanup for the upcoming ABI v2 function implementation (D55045).

llvm-svn: 348778
2018-12-10 18:14:09 +00:00
Marshall Clow 655fb4a767 Update a couple of vector<bool> tests that were testing libc++-specific bahavior. Thanks to Andrey Maksimov for the catch.
llvm-svn: 348660
2018-12-07 22:16:26 +00:00
Louis Dionne 737be83d20 [libcxx] Remove the availability_markup LIT feature
It is now equivalent to the 'availability' LIT feature, so there's no
reason to keep both.

llvm-svn: 348653
2018-12-07 21:48:39 +00:00
Louis Dionne 036a9a0420 [libcxx] Add paranoid cast-to-void in comma operator
llvm-svn: 348611
2018-12-07 16:42:28 +00:00
Louis Dionne 3560fbf304 [libc++] Improve diagnostics for non-const comparators and hashers in associative containers
Summary:
When providing a non-const-callable comparator in a map or set, the
warning diagnostic does not include the point of instantiation of
the container that triggered the warning, which makes it difficult
to track down the problem. This commit improves the diagnostic by
placing it directly in the body of the associative container.

The same change is applied to unordered associative containers, which
had a similar problem.

Finally, this commit cleans up the forward declarations of several
map and unordered_map helpers, which are not needed anymore.

<rdar://problem/41370747>

Reviewers: EricWF, mclow.lists

Subscribers: christof, dexonsmith, llvm-commits

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

llvm-svn: 348529
2018-12-06 21:46:17 +00:00
Louis Dionne 73b9849145 [libcxx] Always convert 'use_system_cxx_lib' to an absolute path
Otherwise, some tests would fail when a relative path was passed,
because they'd use the relative path from a different directory
than the current working directory.

llvm-svn: 348525
2018-12-06 20:09:15 +00:00
Louis Dionne bf3f90c34f [libcxx] Fix incorrect XFAILs for chrono tests on old macos deployment targets
The tests were marked to fail based on the 'availability' LIT feature.
However, those tests should really only be failing when we run them
against the dylibs that were deployed on macosx10.7 and macosx10.8,
which the deployment target has nothing to do with.

This caused the tests to unexpectedly pass when running the tests
with deployment target macosx10.{7,8} but running with a recent dylib.

llvm-svn: 348520
2018-12-06 19:24:20 +00:00
Louis Dionne 7125b08d08 [libcxx] Add checks for unique value of array<T, 0>.begin() and array<T, 0>.end()
The standard section [array.zero] requires the return value of begin()
and end() methods of a zero-sized array to be unique. Eric Fiselier
clarifies: "That unique value cannot be null, and must be properly aligned".
This patch adds checks for the first part of this clarification: unique
value returned by these methods cannot be null.

Reviewed as https://reviews.llvm.org/D55366.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 348509
2018-12-06 18:24:39 +00:00
Louis Dionne 2a23317e69 [libcxx] Add XFAILs for aligned allocation tests on AppleClang 9
Some people are still running the test suite using AppleClang 9.

llvm-svn: 348507
2018-12-06 18:06:47 +00:00
Louis Dionne 26f01c46e9 [libcxx] Make return value of array<T, 0>.data() checked only for libc++
The section array.zero says: "The return value of data() is unspecified".
This patch marks all checks of the array<T, 0>.data() return value as
libc++ specific.

Reviewed as https://reviews.llvm.org/D55364.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 348485
2018-12-06 13:52:20 +00:00
Louis Dionne 2d36473873 [libcxx] Mark some tests as failing on macosx 10.14
llvm-svn: 348437
2018-12-06 00:25:15 +00:00
Louis Dionne f7f5a1f778 [libcxx] Don't depend on availability markup to provide the streams in the dylib
Whether an explicit instantiation declaration should be provided is not
a matter of availability markup.

This problem is exemplified by the fact that some tests were incorrectly
marked as XFAIL when they should instead have been using the definition
of streams from the headers, and hence passing, and that, regardless of
whether visibility annotations are enabled.

llvm-svn: 348436
2018-12-06 00:24:58 +00:00
Louis Dionne f14927e98e [libcxx] Always enable availability in the lit test suite.
Summary:
Running the tests without availability enabled doesn't really make sense:
availability annotations allow catching errors at compile-time instead
of link-time. Running the tests without availability enabled allows
confirming that a test breaks at link-time under some configuration,
but it is more useful to instead check that it should fail at compile-time.

Always enabling availability in the lit test suite will greatly simplify
XFAILs and troubleshooting of failing tests, which is currently a giant
pain because we have these two levels of possible failure: link-time and
compile-time.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 348296
2018-12-04 19:31:08 +00:00
Louis Dionne bb9ca6d0bf [libcxx] Implement P0318: unwrap_ref_decay and unwrap_reference
Summary:
This was voted into C++20 in San Diego. Note that there was a revision
D0318R2 which did include unwrap_reference_t, but we mistakingly voted
P0318R1 into the C++20 Working Draft (which does not include
unwrap_reference_t). This patch implements D0318R2, which is what
we'll end up with in the Working Draft once this mistake has been
fixed.

Reviewers: EricWF, mclow.lists

Subscribers: christof, dexonsmith, libcxx-commits

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

llvm-svn: 348138
2018-12-03 14:03:27 +00:00
Marshall Clow 08794627a3 First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane. (second try)
llvm-svn: 347930
2018-11-29 23:21:18 +00:00
Louis Dionne 9af1d12978 [libcxx] Make UNSUPPORTED for std::async test more fine grained
The test was previously marked as unsupported on all Apple platforms, when
we really just want to mark it as unsupported for previously shipped dylibs
on macosx.

llvm-svn: 347920
2018-11-29 21:25:29 +00:00
Marshall Clow 80fabab677 Revert commit r347904 because it broke older compilers
llvm-svn: 347908
2018-11-29 20:04:47 +00:00
Marshall Clow 8143278500 First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane.
llvm-svn: 347904
2018-11-29 19:49:48 +00:00
Louis Dionne e823b6d7e6 [libcxx] Remove bad_array_length
Summary:
std::bad_array_length was added by n3467, but this never made it into C++.
This commit removes the definition of std::bad_array_length from the headers
AND from the shared library. See the comments in the ABI changelog for details
about the ABI implications of this change.

Reviewers: mclow.lists, dexonsmith, howard.hinnant, EricWF

Subscribers: christof, jkorous, libcxx-commits

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

llvm-svn: 347903
2018-11-29 19:44:57 +00:00
Louis Dionne 8b1f5aae7e [libcxx] More fixes to XFAILs for aligned allocation tests for macosx 10.13
Those tests are a real pain to tweak.

llvm-svn: 347875
2018-11-29 15:52:36 +00:00
Eric Fiselier 9d25ada420 Revert "Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. "
This reverts commit 087f065cb0c7463f521a62599884493aaee2ea12.

The tests were failing on 32 bit builds, and I don't have time
to clean them up right now. I'll recommit tomorrow with fixed tests.

llvm-svn: 347816
2018-11-28 22:24:19 +00:00
Eric Fiselier 901ede719b Fix bad _LIBCPP_ALIGNOF test
llvm-svn: 347790
2018-11-28 18:32:16 +00:00
Marshall Clow 4d64d7dd64 Implement P0966 - string::reserve should not shrink
llvm-svn: 347789
2018-11-28 18:18:34 +00:00
Eric Fiselier 8a486dac25 Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.
Summary:
Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See  llvm.org/PR39713

This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used.

This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement.

I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. 

Reviewers: ldionne, EricWF

Reviewed By: EricWF

Subscribers: christof, libcxx-commits

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

llvm-svn: 347787
2018-11-28 18:16:02 +00:00
Louis Dionne 9a494eacba [libcxx] Remove dynarray
Summary:
std::dynarray had been proposed for C++14, but it was pulled out from C++14
and there are no plans to standardize it anymore.

Reviewers: mclow.lists, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, arphaman, libcxx-commits

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

llvm-svn: 347783
2018-11-28 18:02:00 +00:00
Louis Dionne 4eacdb41e9 [libcxx] Use clang-verify in the lit test suite even when availability is enabled
llvm-svn: 347780
2018-11-28 17:31:17 +00:00
Louis Dionne a86710f1e8 [libcxx] Apply _LIBCPP_INLINE_VISIBILITY for std::hash for string_view
llvm-svn: 347765
2018-11-28 15:22:30 +00:00
Louis Dionne 1497359501 [libcxx] Make sure the re-export logic works when paths contain spaces
llvm-svn: 347711
2018-11-27 21:13:31 +00:00
Louis Dionne 3aeeaff89f [libcxx] Fix libc++ re-exporting logic when Command Line Tools are not installed
Summary:
When the Xcode Command Line tools are not installed but CMAKE_OSX_SYSROOT is
set, we would try to re-export symbols from the libc++abi.dylib shipped in
the sysroot, which does not exist. This commit changes the build on OS X to
always re-export symbols from the explicit re-export lists, which doesn't
change depending on what system you're building on, and is therefore much
less flaky.

Reviewers: EricWF, mclow.lists

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 347708
2018-11-27 20:59:47 +00:00
Marshall Clow 44d247d280 Implement P1085R2 - Should Span be Regular?. This consists entirely of deletions
llvm-svn: 347672
2018-11-27 16:35:41 +00:00
Eric Fiselier e051f98d09 Remove duplicate _LIBCPP_INLINE_VISIBILITY attributes.
This attribute should appear only on the first declaration. This
patch cleans up <string> by removing the attribute on redeclarations.

llvm-svn: 347608
2018-11-26 22:51:35 +00:00
Eric Fiselier 01a87ef88b Add basic_string::__resize_default_init (from P1072)
This patch adds an implementation of __resize_default_init as
described in P1072R2. Additionally, it uses it in filesystem to
demonstrate its intended utility.

Once P1072 lands, or if it changes it's interface, I will adjust
the internal libc++ implementation to match.

llvm-svn: 347589
2018-11-26 20:15:38 +00:00
Louis Dionne 94104b1b6b [libcxx] Fix XFAILs for aligned allocation tests
In r339743, I marked several aligned allocation tests as downright
unsupported on macosx in an attempt to unbreak the build. It turns
out that marking them as unuspported whenever we're on OS X is way
too coarse grained. This commit marks the tests as XFAIL with more
granularity.

llvm-svn: 347585
2018-11-26 19:30:08 +00:00
Louis Dionne 7ae4f5c6de [libcxx] Fix XFAIL for aligned deallocation test with trunk Clang
The test was marked as failing whenever the deployment target was 10.12
or older, but in reality the test passes when the deployment target is
10.12 on recent Clangs. This happens because only older clangs do not
honor the -faligned-allocation flag, which disables any availability
error related to aligned allocation support, regardless of the
deployment target.

llvm-svn: 347580
2018-11-26 17:47:16 +00:00
Louis Dionne 20883fc20f [libcxx] Use a type that is always an aggregate in variant's tests
Summary:
In PR39232, we noticed that some variant tests started failing in C++2a mode
with recent Clangs, because the rules for literal types changed in C++2a. As
a result, a temporary fix was checked in (enabling the test only in C++17).

This commit is what I believe should be the long term fix: I removed the
tests that checked constexpr default-constructibility with a weird type
from the tests for index() and valueless_by_exception(), and instead I
added tests for those using an obviously literal type in the test for the
default constructor.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, arphaman, libcxx-commits, rsmith

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

llvm-svn: 347568
2018-11-26 16:14:56 +00:00
Louis Dionne 2d91d2a388 [NFC] Fix typo in comment
llvm-svn: 347477
2018-11-22 19:10:28 +00:00
Louis Dionne 3ffe0b75fb [libcxx] Reintroduce UNSUPPORTED annotation for strstreambuf overflow test
This is a revert of r347421, except I'm using the with_system_cxx_lib
lit feature instead of availability to mark the test as unsupported
(because the problem is a bug in the dylib itself). In r347421, I said
I wasn't able to reproduce the issue and that's why I was removing it:
this was because I ran lit slightly wrong. The problem mentioned really
exists.

llvm-svn: 347475
2018-11-22 17:43:22 +00:00
Louis Dionne 5b2605edc4 [libcxx] Add XFAIL for test on OS X 10.12 to 10.14
llvm-svn: 347473
2018-11-22 16:38:03 +00:00
Louis Dionne 893413318f [NFC][libcxx] Print human-friendly command line when lit test fails
We used to print a Python list corresponding to the command. It is more
useful to print the joined string so it can be copy/pasted directly when
a test fails.

llvm-svn: 347471
2018-11-22 16:10:49 +00:00
Louis Dionne 509f7d7c30 [libcxx] Remove incorrect XFAIL on macos 10.12
llvm-svn: 347461
2018-11-22 13:40:56 +00:00
Louis Dionne bb4f2dfc36 [libcxx] Improve error message when an invalid directory is provided as use_system_cxx_lib
llvm-svn: 347435
2018-11-21 23:00:45 +00:00
Louis Dionne 2804508ffe [libcxx] Remove unused definition of aligned allocation macro on old OS X
We don't support mac OS 10.6 and older anymore, so this macro can never
be defined. This bit of code had been added in D28931 as a fix for
PR31448, but it doesn't seem necessary anymore.

llvm-svn: 347427
2018-11-21 21:22:08 +00:00
Louis Dionne 91614db033 [libcxx] Fix incorrect iterator type in vector container test
The iterator types for different specializations of containers with the
same element type but different allocators are not required to be
convertible. This patch makes the test to take the iterator type from
the same container specialization as the created container.

Reviewed as https://reviews.llvm.org/D54806.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 347423
2018-11-21 20:53:07 +00:00
Louis Dionne 94d4c9e094 [libcxx] Mark strstreams tests as being supported on all OS X versions
I wasn't able to reproduce the issue referred to by the comment using
the libc++'s shipped with mac OS X 10.7 and 10.8, so I assume this may
have been fixed in a function that is now shipped in the headers. In
that case, the tests will pass no matter what dylib we're using.

In the worst case, some test bots will start failing and I'll understand
why I was wrong, and I can create an actual lit feature for it. Note
that I could just leave this test alone, but this change is on the path
towards eradicating vendor-specific availability markup from the test
suite.

llvm-svn: 347421
2018-11-21 20:47:00 +00:00