Commit Graph

173 Commits

Author SHA1 Message Date
Reid Kleckner 324568f909 Fix discovery of cxxabi.h in the monorepo layout
llvm-svn: 305841
2017-06-20 20:34:13 +00:00
Eric Fiselier 3ca9185073 Add <experimental/coroutine>
This patch adds the library portions of the coroutines PDTS,
which should now be supported by Clang.

llvm-svn: 303836
2017-05-25 04:36:24 +00:00
Eric Fiselier 7d6b2ad5a3 test commit
llvm-svn: 302122
2017-05-04 06:28:34 +00:00
Eric Fiselier e243c3df97 test commit
llvm-svn: 302120
2017-05-04 06:27:06 +00:00
Jonas Hahnfeld 98a7f2798d [libcxx][CMake] Set library dir when built under runtimes/
This will put libraries into the build root's lib/ directory by default.

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

llvm-svn: 302117
2017-05-04 06:02:50 +00:00
Duncan P. N. Exon Smith 8e5f0409fb CMake: Only add test/ subdirectory when it exists
r296685 started adding the test/ subdirectory even when
LIBCXX_INCLUDE_TESTS=OFF.  This is great for testing libcxx standalone,
but it also breaks the build when the test/ subdirectory is removed
(and our submission system strips all test/ directories).

This patch updates the logic to check for test/ before adding it.

rdar://problem/31931366

llvm-svn: 302095
2017-05-03 23:33:54 +00:00
Shoaib Meenai 8048b44a8c [libc++] Default to vcruntime when targeting MSVC
Summary:
libc++abi is never the right option for LIBCXX_TARGETING_MSVC, since it
targets the Itanium ABI, whereas MSVC uses the Microsoft ABI. Make the
default ABI be vcruntime when targeting MSVC even if libc++abi is
present in the tree.

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

llvm-svn: 300921
2017-04-20 23:33:49 +00:00
Eric Fiselier ed004ef206 Disable the filesystem library on Windows by default
llvm-svn: 300820
2017-04-20 04:24:29 +00:00
Petr Hosek 539b1ec9d8 [CMake][libcxx] Fix the --target and --gcc-toolchain flag handling
CMake has the problem with the single dash variant because of the
space, so use the double dash with equal sign version. We also
don't have to pass the target triple when checking for compiler-rt
since that flag is already included in compile flags now.

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

llvm-svn: 300409
2017-04-16 02:25:55 +00:00
Shoaib Meenai 6170765a3c [libc++] Explicitly set output directory for DLL
DLLs on Windows are treated as runtime targets. Explicitly set the
output directory for them, to be consistent with other platforms.

llvm-svn: 300206
2017-04-13 16:27:38 +00:00
Eric Fiselier e4bda11453 suppress GCC warning about noexcept functions changing mangling
llvm-svn: 299385
2017-04-03 20:53:15 +00:00
Shoaib Meenai f88923d9bf [libc++] Fix some comment typos
Remove a stray letter, add a missing letter. No functional change.

llvm-svn: 298766
2017-03-25 03:42:20 +00:00
Shoaib Meenai b73d43521f [libc++] Fix word transposition in comment
"to due" -> "due to". No functional change.

llvm-svn: 298764
2017-03-25 03:29:51 +00:00
Shoaib Meenai 84904fb7ea [libc++] Fix capitalization in comment
Fix a stray capital letter in the middle of a sentence. No functional
change.

llvm-svn: 298763
2017-03-25 03:22:35 +00:00
Shoaib Meenai 301854203c [libc++] Update package version
Make it consistent with the rest of LLVM.

llvm-svn: 298762
2017-03-25 03:12:37 +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 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 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
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
Eric Fiselier d22c9dc422 Recommit "Split exception.cpp and new.cpp implementation into different files for different runtimes."
This recommits r294707 with additional fixes. The main difference is
libc++ now correctly builds without any ABI library.

exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
each different ABI library we support, and it's getting unmaintainable.

This patch breaks down exception.cpp into multiple different header files,
roughly one per implementation. Additionally it moves the definitions of
exceptions in new.cpp into the correct implementation header.

This patch also removes an unmaintained libc++abi configuration.
This configuration may still be used by Apple internally but there
are no other possible users. If it turns out that Apple still uses
this configuration internally I will re-add it in a later commit.
See http://llvm.org/PR31904.

llvm-svn: 294730
2017-02-10 08:57:35 +00:00
Eric Fiselier 8dcdeaeb35 Revert "Split exception.cpp and new.cpp implementation into different files for different runtimes."
The compiler-rt CMake configuration needs some tweaking before this can land.

llvm-svn: 294727
2017-02-10 07:43:08 +00:00
Eric Fiselier 7f15e08ca1 Correctly default to using the system libc++abi on Apple.
This patch fixes a regression where libc++ didn't correctly
select the system libc++abi when no in-tree version was found.

llvm-svn: 294712
2017-02-10 05:07:03 +00:00
Eric Fiselier def60acdf5 Split exception.cpp and new.cpp implementation into different files for different runtimes.
exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
each different ABI library we support, and it's getting unmaintainable.

This patch breaks down exception.cpp into multiple different header files,
roughly one per implementation. Additionally it moves the definitions of
exceptions in new.cpp into the correct implementation header.

This patch also removes an unmaintained libc++abi configuration.
This configuration may still be used by Apple internally but there
are no other possible users. If it turns out that Apple still uses
this configuration internally I will re-add it in a later commit.
See http://llvm.org/PR31904.

llvm-svn: 294707
2017-02-10 04:25:33 +00:00
Petr Hosek b494288b9e [libcxx][CMake] Support in-tree libunwind when building as part of runtimes
When building as part of runtimes, there is no predefined order in
which the runtimes are loaded, so the targets from other projects
might not be available. We need to rely on HAVE_<name> variables
instead in that case.

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

llvm-svn: 294553
2017-02-09 02:19:43 +00:00
Eric Fiselier f1fe87e605 Remove CMake hack
llvm-svn: 294116
2017-02-05 01:19:02 +00:00
Eric Fiselier e49cdfbeea Recommit [libcxx] Never use <cassert> within libc++
It is my opinion that libc++ should never use `<cassert>`, including in the `dylib`.
This patch remove all uses of `assert` from within libc++ and replaces most of them with `_LIBCPP_ASSERT` instead.

Additionally this patch turn `LIBCXX_ENABLE_ASSERTIONS`  off by default,
because the standard library should not be aborting user programs unless explicitly asked to.

llvm-svn: 294107
2017-02-04 23:22:28 +00:00
Eric Fiselier f9e7bf3a43 Revert "[libcxx] Never use <cassert> within libc++"
This reverts commit r292883. Unfortunately <string_view> uses
_LIBCPP_ASSERT in a way which is not compatible with the C++11 dylib
build. I'll investigate more tomorrow.

llvm-svn: 292923
2017-01-24 12:26:01 +00:00
Eric Fiselier d5fd7d7ea1 [libcxx] Never use <cassert> within libc++
Summary:
It is my opinion that libc++ should never use `<cassert>`, including in the `dylib`. This patch remove all uses of `assert` from within libc++ and replaces most of them with `_LIBCPP_ASSERT` instead.

Additionally this patch turn `LIBCXX_ENABLE_ASSERTIONS`  off by default, because the standard library should not be aborting user programs unless explicitly asked to.

Reviewers: mclow.lists, compnerd, smeenai

Reviewed By: mclow.lists

Subscribers: mgorny, cfe-commits

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

llvm-svn: 292883
2017-01-24 04:57:33 +00:00
Eric Fiselier 6dede18cb1 Don't strip -m32 from the user provide command line flags. This fixes the compiler-rt 32 bit sanitizer build
llvm-svn: 292291
2017-01-17 23:27:56 +00:00
Eric Fiselier 1cd196e7b4 Improve CMake and LIT support for Windows
This patch contains multiple cleanups and fixes to better support building on
Windows.

* [Test] Fix handling of library runtime search paths by correctly adding them
  to the PATH variable when running the tests.

* [Test] Don't explicitly force "--target=i686-pc-windows" when running the
  test suite. Clang++ seems to deduce the correct target.

* [Test] Fix `.sh.cpp` tests on Windows by properly escaping flags used in
  shell commands. Specifically windows style paths which included spaces
  were causing these tests to fail.

* [CMake] Add "vcruntime" to the list of supported C++ ABI libraries in CMake, and
  teach the test suite how to handle it. For now libc++ defaults to using
  "vcruntime" on Windows except when libc++abi is in tree; That is probably
  a bug and should be changed to always use vcruntime, at least for now.

* [Misc] Move the "c++-build" include directory to the libc++ binary dir
  instead of the top level project dir and rename it "c++build". This is just
  misc cleanup. Libc++ shouldn't be creating internal build files and directories
  at the top-level projects root.

* [Misc] Build type_info's destructor when building for MSVC. This is a temporary
  work around to prevent link errors until we have a proper type_info
  implementation.

llvm-svn: 292157
2017-01-16 20:47:35 +00:00
Petr Hosek 2203aa9a28 Reland "[CMake][libcxx] Check that we have libcxxabi before using it"
This relands commit r291726.

llvm-svn: 292086
2017-01-16 00:33:11 +00:00
Petr Hosek 06d3c51c88 Reland "[CMake][libcxx] Do not rely on the existence of c++abi or unwind targets"
This relands commit r291727.

llvm-svn: 292085
2017-01-16 00:33:09 +00:00
Petr Hosek daf3a69460 Reland "[CMake][libcxx] Move Python check to main CMake file"
This relands commit r291728.

llvm-svn: 292084
2017-01-16 00:33:07 +00:00
Eric Fiselier 7e3ee09ad2 [libc++][CMake] Use debug MSVC runtimes when libc++ is built in debug mode
Summary: This patch allows libc++ to be built against the debug MSVC runtimes instead of just the release ones.

Reviewers: rnk, majnemer, compnerd, smeenai

Subscribers: mgorny, cfe-commits

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

llvm-svn: 292006
2017-01-14 07:54:39 +00:00
Eric Fiselier cc1f65ca30 [libc++] [CMake] Link with /nodefaultlibs on Windows
Summary:
This patch attempts to fix the libc++ build/link so that it doesn't use an default C++ libraries on Windows.  This is needed to prevent linking to MSVC's STL library.

Additionally this patch changes libc++ so that it is always linked with the non-debug DLL's (e.g. `/MD`). This is needed so that the test suite can correctly link the same libraries without needing to know which configuration `c++.dll` was linked with.


Reviewers: compnerd, rnk, majnemer, kimgr, awson, halyavin, smeenai

Subscribers: cfe-commits, mgorny

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

llvm-svn: 292001
2017-01-14 06:06:47 +00:00
Petr Hosek 895f24ce17 Revert "[CMake][libcxx] Move Python check to main CMake file"
This reverts commit 39441fe9f00a58ffc2fdff92a4b0e8a280a5f444.

llvm-svn: 291728
2017-01-11 23:56:33 +00:00
Petr Hosek 8782d22b26 Revert "[CMake][libcxx] Do not rely on the existence of c++abi or unwind targets"
This reverts commit 94fc5a96f58071703d81d14690094dcd266a5e17.

llvm-svn: 291727
2017-01-11 23:56:31 +00:00
Petr Hosek 8c6ac2853d Revert "[CMake][libcxx] Check that we have libcxxabi before using it"
This reverts commit 8c91834411b322ab360eb1f193f489327e719652.

llvm-svn: 291726
2017-01-11 23:56:29 +00:00
Petr Hosek 7e35ee4b8b [CMake][libcxx] Check that we have libcxxabi before using it
When doing standalone build, check that we actually have libcxxabi
before attempting to use it.

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

llvm-svn: 291723
2017-01-11 23:11:40 +00:00
Petr Hosek 777de22120 [CMake][libcxx] Do not rely on the existence of c++abi or unwind targets
There is no guaranteed order in which CMake files for individual
runtimes are invoked and therefore we cannot rely on existence of
targets defined in other runtimes. Use the new HAVE_<name> options
instead in those cases.

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

llvm-svn: 291632
2017-01-11 00:56:10 +00:00
Petr Hosek 1612f8c420 [CMake][libcxx] Move Python check to main CMake file
This is to make sure this check is called even when building as
part of LLVM runtimes when we are doing standalone but not out of
tree build.

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

llvm-svn: 291592
2017-01-10 19:51:17 +00:00
Asiri Rathnayake b71c89913c [libcxx] Fix externally-threaded shared library builds after r291275.
Need to allow unresolved symbols in the dylib. This was previously done for
LIBCXX_HAS_EXTERNAL_THREAD_API, but we have since split that into two with
LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY being the externally-threaded variant.

Also a minor CMakeLists.txt cleanup.

llvm-svn: 291433
2017-01-09 10:38:56 +00:00
Eric Fiselier 937c74cdab Configure default ABI library as NONE on Windows
llvm-svn: 291306
2017-01-06 23:59:52 +00:00
Eric Fiselier 00f6beaed4 [libc++] Cleanup and document <__threading_support>
Summary:
This patch attempts to clean up the macro configuration mess in `<__threading_support>`, specifically the mess involving external threading variants. Additionally this patch adds design documentation for `<__threading_support>` and the configuration macros it uses.

The primary change in this patch is separating the idea of an "external API" provided by `<__external_threading>` and the idea of having an external threading library. Now `_LIBCPP_HAS_THREAD_API_EXTERNAL` means that libc++ should use `<__external_threading>` and that the header is expected to exist.  Additionally the new macro `_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL` is now used to configure for using an "external library"  with the default threading API.

Reviewers: compnerd, rmaprath

Subscribers: smeenai, cfe-commits, mgorny

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

llvm-svn: 291275
2017-01-06 20:05:40 +00:00
Asiri Rathnayake 205d7d3f68 [libcxx] Add build/test support for the externally threaded libc++abi variant
Differential revision: https://reviews.llvm.org/D27576

Reviewers: EricWF
llvm-svn: 290889
2017-01-03 12:59:50 +00:00
Eric Fiselier 1285e4d60e Recommit r290839 - Fix configuring and building libc++ w/o an ABI library.
This patch re-commits a previous attempt to support building libc++ w/o
an ABI library. That patch was originally reverted because:

1) It forgot to teach the test suite about "default" ABI libraries.

2) Some LLVM builders don't clear the CMake cache between builds. The previous
   patch caused those builders to fail since their old cache entry for
   LIBCXX_CXX_ABI="" is no longer valid.

The updated patch addresses both issues. It works around (2) by adding
a hack to force the builders to update their cache entries. The hack will
be removed shortly once all LLVM builders have run.

Original commit message
-----------------------

Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits
of the C++ STL. However we also support building w/o an ABI library entirely.
This patch fixes building libc++ w/o an ABI library (and incorporates the
`~type_info()` fix in D28211).

The main changes in this patch are:

1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default".
2) Fix CMake bits which treated "none" as "default" on OS X.
3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`.
4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined.

Unfortunately this patch doesn't help clean up the macro mess that we use to
configure for different ABI libraries.

llvm-svn: 290849
2017-01-03 01:18:48 +00:00
Eric Fiselier 221596df33 Revert r290839 - Fix configuring and building libc++ w/o an ABI library
llvm-svn: 290841
2017-01-02 22:27:45 +00:00
Eric Fiselier 5d25843f66 Fix configuring and building libc++ w/o an ABI library.
Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits
of the C++ STL. However we also support building w/o an ABI library entirely.
This patch fixes building libc++ w/o an ABI library (and incorporates the
`~type_info()` fix in D28211).

The main changes in this patch are:

1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default".
2) Fix CMake bits which treated "none" as "default" on OS X.
3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`.
4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined.

Unfortunately this patch doesn't help clean up the macro mess that we use to
configure for different ABI libraries.

llvm-svn: 290839
2017-01-02 21:58:06 +00:00
Saleem Abdulrasool 58729cd53e build: tweak macros for Windows build
Move the windows specific macro definitions for compiling c++ into the
target.  Add a number of newer options that are necessary to properly
build libc++ for windows.  This ensures that we do not accidentally
autolink msvcprt (Microsoft's C++ runtime library), do not define linker
pragmas which are msvcprt specific, and do not accidentally encode the
incorrect version of the msvc compatibility version.

llvm-svn: 290837
2017-01-02 21:40:17 +00:00
Saleem Abdulrasool 581bb5b9dd build: further improve flags handling for cl
This allows us to build with cl (or rather clang-cl) by using the
correct spelling for `-include` (`/FI` for cl).  clang-cl and cl default
to C++11/C++14 as they support it rather than permitting an explicit
language standard.

llvm-svn: 290802
2017-01-01 20:20:40 +00:00