Commit Graph

190 Commits

Author SHA1 Message Date
Petr Hosek de2b464504 [CMake] Set the default ABI version for Fuchsia in CMake as well
This is neeeded since the CMake value is used for the SOVERSION.

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

llvm-svn: 329983
2018-04-13 01:59:15 +00:00
Dimitry Andric 35479ffb12 Add default C++ ABI libname and include paths for FreeBSD
Summary:
As noted in a discussion about testing the LLVM 6.0.0 release candidates
(with libc++) for FreeBSD, many tests turned out to fail with
"exception_ptr not yet implemented".  This was because libc++ did not
choose the correct C++ ABI library, and therefore it fell back to the
`exception_fallback.ipp` header.

Since FreeBSD 10.x, we have been using libcxxrt as our C++ ABI library,
and its headers have always been installed in /usr/include/c++/v1,
together with the (system) libc++ headers.  (Older versions of FreeBSD
used GNU libsupc++ by default, but these are now unsupported.)

Therefore, if we are building libc++ for FreeBSD, set:
* `LIBCXX_CXX_ABI_LIBNAME` to "libcxxrt"
* `LIBCXX_CXX_ABI_INCLUDE_PATHS` to "/usr/include/c++/v1"
by default.

Reviewers: emaste, EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: mgorny, cfe-commits, krytarowski

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

llvm-svn: 324855
2018-02-11 22:31:05 +00:00
Don Hinton 98bb420559 [cmake] [libcxx] Fix find_path() problems when cross compiling.
When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, this find_path() invocation is looking for a path in the
libcxxabi project on the host system, not the target system,
which can be done by passing NO_CMAKE_FIND_ROOT_PATH.

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

llvm-svn: 323143
2018-01-22 19:26:38 +00:00
Martin Storsjo bf02a09103 [cmake] Add a config option LIBCXX_HAS_WIN32_THREAD_API for enforcing win32 threads
This allows keeping libcxx using win32 threads even if a
version of pthread.h is installed.

This matches the existing cmake option LIBCXX_HAS_PTHREAD_API.

Also add missing documentation about the internal define
_LIBCPP_HAS_THREAD_API_WIN32.

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

llvm-svn: 321896
2018-01-05 20:48:29 +00:00
Hans Wennborg 6be97eca93 Update version to 7.0.0svn: cmake, include files and docs
llvm-svn: 321725
2018-01-03 15:40:29 +00:00
Petr Hosek 363c631edd Include AddLLVM needed for tests in the right context
AddLLVM is needed for several functions that are used in tests and
as such needs to be included from the right context which previously
wasn't the case.

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

llvm-svn: 319515
2017-12-01 03:16:50 +00:00
Shoaib Meenai 492d7134f3 [libc++] Support Microsoft ABI without vcruntime headers
The vcruntime headers are hairy and clash with both libc++ headers
themselves and other libraries. libc++ normally deals with the clashes
by deferring to the vcruntime headers and silencing its own definitions,
but for clients which don't want to depend on vcruntime headers, it's
desirable to support the opposite, i.e. have libc++ provide its own
definitions.

Certain operator new/delete replacement scenarios are not currently
supported in this mode, which requires some tests to be marked XFAIL.
The added documentation has more details.

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

llvm-svn: 315234
2017-10-09 19:25:17 +00:00
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
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
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
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
Hans Wennborg 9e82a506ae Update _LIBCPP_VERSION and the version in CMakeLists to 6.0
llvm-svn: 308468
2017-07-19 13:57:10 +00:00
Petr Hosek 510e70fdd5 [libcxx][CMake] Add install path variable to allow overriding the destination
This is going to be used by the runtime build in the multi-target
setup to allow using different install prefix for each target.

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

llvm-svn: 307615
2017-07-11 02:39:50 +00:00
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