Commit Graph

310 Commits

Author SHA1 Message Date
Louis Dionne e6d94f4bd2 [libc++abi] Replace LIBCXXABI_HAS_NO_EXCEPTIONS by TEST_HAS_NO_EXCEPTIONS
This clarifies the difference between test for exception support in
libc++abi tests and support for exceptions built into libc++abi.
This also removes the rather confusing similarity between the
_LIBCXXABI_NO_EXCEPTIONS and LIBCXXABI_HAS_NO_EXCEPTIONS macros.

Finally, TEST_HAS_NO_EXCEPTIONS is also detected automatically based
on -fno-exceptions, so it doesn't have to be specified explicitly
through Lit's compile_flags.
2020-06-09 16:13:17 -04:00
Louis Dionne 168681abce [libc++abi][libunwind] Don't override libc++'s handling of exception features
0e04342ae0 simplified exceptions-related configurations for libc++abi
and libunwind by reusing the logic in libc++. However, it missed the fact
that libc++abi and libunwind were overriding libc++'s handling of exceptions.

This commit removes special handling in libc++abi and libunwind to use
the logic in libc++, which is the right one.
2020-06-09 16:03:22 -04:00
Louis Dionne 0e04342ae0 [NFCI] Clean up exceptions related CMake and Lit options in libc++abi and libunwind
First, libc++abi doesn't need to add the no-exceptions Lit feature itself,
since that is already done in the config.py for libc++, which it reuses.
Specifically, config.enable_exceptions is set based on @LIBCXXABI_ENABLE_EXCEPTIONS@
in libc++abi's lit.cfg.in, and libc++'s config.py handles that correctly.

Secondly, libunwind's LIBUNWIND_ENABLE_EXCEPTIONS is never set (it's
probably a remnant of copy-pasting code between the runtime libraries),
so the library is always built with exceptions disabled (which makes
sense since it implements the runtime support for exceptions).
Conversely, the test suite is always run with exceptions enabled
(not sure why), but that is preserved by the default behavior of
libc++'s config.py.
2020-06-09 15:34:29 -04:00
Louis Dionne d520dfec3b [libc++abi] Properly fix XFAILs for exception alignment
Since <unwind.h> is in the SDK, not in /usr/include, the XFAILs must
be predicated on the compiler version (ideally even on the SDK version)
instead of the target system version.
2020-06-05 13:08:46 -04:00
Louis Dionne bf61891146 [libc++abi] Fix incorrect XFAILs for mis-aligned _Unwind_Exception on Apple
The problem mentioned in the XFAILs has been resolved in macosx10.15, so
the test is now XPASSing on that platform.

rdar://63640184
2020-06-03 10:08:15 -04:00
Louis Dionne 31cbe0f240 [libc++] Remove the c++98 Lit feature from the test suite
C++98 and C++03 are effectively aliases as far as Clang is concerned.
As such, allowing both std=c++98 and std=c++03 as Lit parameters is
just slightly confusing, but provides no value. It's similar to allowing
both std=c++17 and std=c++1z, which we don't do.

This was discovered because we had an internal bot that ran the test
suite under both c++98 AND c++03 -- one of which is redundant.

Differential Revision: https://reviews.llvm.org/D80926
2020-06-03 09:37:22 -04:00
Erik Pilkington 1c1fb350c5 [demangler] Support for 'this' expressions
llvm.org/PR45896
2020-05-13 22:28:51 -04:00
Erik Pilkington 15426b2161 [demangler] Fix demangling of enumerators with negative values
rdar://27527445
2020-05-13 14:32:08 -04:00
Louis Dionne 363393c4b3 [libc++abi] Adjust XFAIL on macOS for bug that was fixed in recent OSes 2020-05-12 17:00:03 -04:00
Louis Dionne 78769923fe [libc++abi] Add -Wno-unreachable-code when building test for throwing incomplete types
Slightly older Clangs seem to think they are more clever than they really
are, and they think the code can never be executed. The code can actually
be executed in case the exception runtime is mis-implemented, which is
exactly what this test is testing. This commit just disables the spurious
warning.
2020-05-01 15:29:40 -04:00
Louis Dionne 8c61114c53 [libc++/abi/unwind] Rename Lit features for no exceptions to 'no-exceptions'
Instead of having different names for the same Lit feature accross code
bases, use the same name everywhere. This NFC commit is in preparation
for a refactor where all three projects will be using the same Lit
feature detection logic, and hence it won't be convenient to use
different names for the feature.

Differential Revision: https://reviews.llvm.org/D78370
2020-04-22 08:25:27 -04:00
Louis Dionne e1c67273d5 [libc++abi] NFC: Remove trailing whitespace 2020-04-17 10:07:18 -04:00
Louis Dionne 2eb8864be2 [libc++abi] Enable the new libc++ testing format by default
The new format should be equivalent to the old format, and it is now the
default format when running the libc++ tests. This commit changes the
libc++abi tests to use the new format by default too. If unexpected failures
are discovered, it should be fine to revert this commit until they are
addressed.

Also note that it is still possible to use the old format by passing
`--param=use_old_format=True` when running Lit for the time being.
2020-04-07 09:16:06 -04:00
Louis Dionne 8a42bf24ae [lit] Move the recursiveExpansionLimit setting to TestingConfig
The LitConfig is shared across the whole test suite. However, since
enabling recursive expansion can be a breaking change for some test
suites, it's important to confine the setting to test suites that
enable it explicitly.

Note that other issues were raised with the way recursiveExpansionLimit
operates. However, this commit simply moves the setting to the right
place -- the mechanism by which it works can be improved independently.

Differential Revision: https://reviews.llvm.org/D77415
2020-04-06 13:58:00 -04:00
Louis Dionne 80a2ddf65c [libc++] Add an alternative Lit test format
This new test format is simpler and more flexible. It creates Lit ShTests
on the fly that reuse existing substitutions (like %{cxx}) instead of
having complex logic in Python to run the tests. This has the benefit
that virtually no coding is required to customize how the test suite is
run -- one can achieve pretty much anything by defining the appropriate
substitutions in a simple lit.cfg file.

For example, in order to run the tests on an embedded device after
building with a specific SDK, one can set the %{cxx} and %{compile_flags}
substitutions to use that SDK, and the %{exec} substitution to the ssh.py
script currently used for .sh.cpp tests with a remote executor. Dealing with
the SSHExecutor becomes unnecessary, since all tests are treated like ShTests.

As a side effect of this design, configuration files for the test
suite can be as simple as:

	config.substitutions.append(('%{cxx}', '<path-to-compiler>'))
	config.substitutions.append(('%{compile_flags}', '<flags>'))
	config.substitutions.append(('%{link_flags}', '<flags>'))
	config.substitutions.append(('%{exec}', '<script-to-execute>'))

This should allow storing lit.cfg files for various configurations
directly in the repository instead of relying on complicated logic
in config.py to set up the right flags. I've found numerous problems
in that logic in the past years, and it seems like having simple and
explicit configuration files for the configurations we support is
going to solve most of these problems. Specifically, I am hoping to
store configuration files for testing other Standard Libraries in
the repository.

Improving the interaction with the test suite configuration is still a
work in progress, so for now this test format reuses the substitutions and
available features that are set up by the current config.py.

This new test format should support pretty much everything that the current
test format supports, however it will not be enabled by default at first to
make sure we're satisfied with it. For a short period of time, the new format
will require `--param=use_new_format=True` to be enabled, however it is a very
short term goal to replace the current testing format entirely and to simplify
the configuration accordingly.

Differential Revision: https://reviews.llvm.org/D77338
2020-04-03 11:35:27 -04:00
Sergej Jaskiewicz fee0026fc7 [libc++abi] Fix remote execution of .sh.cpp tests
This aims to fix test failures on the following buildbots:

- http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l
- http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64

Differential Revision: https://reviews.llvm.org/D77190
2020-04-01 10:09:07 -04:00
Louis Dionne c3ca11771e [libc++abi] Remove the old testit script
It's not used anymore, we use Lit as a test runner now (and have been
for a long time).
2020-03-31 11:53:58 -04:00
Louis Dionne e9271a494f Remove legacy CMake targets for libcxx and libcxxabi
We've been meaning to remove those targets for a while, and the fix is
simple enough cause they're all just aliases to other targets.

This is a re-application of f383fb40b1, wich was reverted in 04d48111b
because the build bots had not been updated yet. The build bot configurations
have now been updated not to use the deprecated targets, and I verified
that they were using the non-deprecated targets, so we should be good
unless I missed a bot.

Differential Revision: https://reviews.llvm.org/D76104
2020-03-30 09:45:21 -04:00
Louis Dionne 08776defa5 [libc++/libc++abi] Properly delimit lit substitutions
lit is not very clever when it performs substitution on RUN lines. It
simply looks for a match anywhere in the line (without tokenization)
and replaces it by the expansion. This means that a RUN line containing
e.g. `-verify-ignore-unexpected=note` wouod be expanded to
`-verify-ignore-unexpected=<substitution for not>e`, which is
surprising and nonsensical.

It also means that something like `%compile_module` could be expanded
to `<substitution-for-%compile>_module` or to the correct substitution,
depending on the order in which substitutions are evaluated by lit.

To avoid such problems, it is a good habit to delimit custom substitutions
with some token. This commit does that for all substitutions used in the
libc++ and libc++abi test suites.
2020-03-27 10:27:38 -04:00
Louis Dionne abcb9bb742 [libc++abi] Remove unused lit feature 2020-03-26 13:14:51 -04:00
Louis Dionne 04d48111bf Revert "Remove legacy CMake targets for libcxx and libcxxabi"
This reverts commit f383fb40b. It looks like several of our build bots
are still using the legacy target names, so we'll change those before
we commit this change again.
2020-03-23 11:03:00 -04:00
Louis Dionne f383fb40b1 Remove legacy CMake targets for libcxx and libcxxabi
We've been meaning to remove those targets for a while, and the fix is
simple enough cause they're all just aliases to other targets.

There's no doubt this commit will break some CI systems, however the
fix is trivial.

Differential Revision: https://reviews.llvm.org/D76104
2020-03-23 10:51:23 -04:00
Sergej Jaskiewicz 43252c1b17 [libcxxabi] Set LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX to ON if LIBCXX_ENABLE_SHARED is not defined
Differential Revision: https://reviews.llvm.org/D71894
2020-03-12 16:45:21 +03:00
Kazuaki Ishizaki dac7cda3a8 [libcxxabi] NFC: Fix trivial typos in comments
Reviewers: EricWF, mclow.lists, Jim

Reviewed By: Jim

Subscribers: mgorny, christof, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D72151
2020-01-22 11:36:31 +08:00
Krzysztof Parzyszek 020041d99b Update spelling of {analyze,insert,remove}Branch in strings and comments
These names have been changed from CamelCase to camelCase, but there were
many places (comments mostly) that still used the old names.

This change is NFC.
2020-01-21 10:15:38 -06:00
Eric Fiselier d15fad2653 [libc++][libc++abi] Fix or suppress failing tests in single-threaded
builds.

Fix a libc++abi test that was incorrectly checking for threading
primitives even when threading was disabled.

Additionally, temporarily XFAIL some module tests that fail because
the <atomic> header is unsupported but still built as a part of the
std module.

To properly address this libc++ would either need to produce a different
module.modulemap for single-threaded configurations, or it would need
to make the <atomic> header not hard-error and instead be empty
for single-threaded configurations
2020-01-19 21:49:14 -05:00
Sergej Jaskiewicz fb76c7934d [libcxxabi] Allow tests to link with static libc++abi/libc++ even if the shared version is present
Summary:
Right now the only way to force libc++abi tests to link with the static version of libc++abi is to set `LIBCXXABI_ENABLE_SHARED` to `OFF`. However, this doesn't work when libc++abi is built as standalone project because of [this](54c5224203/libcxxabi/CMakeLists.txt (L503-L519)).

This change allows specifying the version of the library for tests to link with.

This is useful for remote testing, for example, with `SSHExecutor`, where we _have_ to link with libc++abi statically.

Two new CMake options are introduced here: `LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI` and `LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX`. They can be set to `OFF` to tell the test utility to link tests with the static libraries.

It shouldn't break anything, because the default values of these options are set such that the test utility will behave the same way.

Reviewers: EricWF, mclow.lists, phosek, mehdi_amini, ldionne, jroelofs, bcraig

Subscribers: mgorny, christof, ldionne, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D71894
2020-01-09 19:01:57 +03:00
Richard Smith a9727033fb P1152R4: Fix deprecation warnings in libc++ testsuite and in uses of is_invocable that would internally conjure up a deprecated function type.
Summary: The implementation of P1152R4 in Clang has resulted in some deprecation warnings appearing in the libc++ and libc++abi test suite. Fix or suppress these warnings.

Reviewers: mclow.lists, EricWF

Subscribers: christof, ldionne, libcxx-commits

Tags: #libc

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

llvm-svn: 375307
2019-10-19 00:06:00 +00:00
David Zarzycki 7568899b35 [Testing] unbreak after r372963
llvm-svn: 372967
2019-09-26 11:32:02 +00:00
Eric Fiselier 75c9eb5ab2 Update XFAIL list for new GCC versions
llvm-svn: 371881
2019-09-13 18:43:29 +00:00
Richard Smith 865697f9b9 Fix incorrect demangling of call operator of lambda with explicit
template parameters due to registering template parameters twice.

llvm-svn: 371469
2019-09-09 23:07:25 +00:00
Richard Smith 2ca7370183 Simplify demangler rule for lambda-expressions to match discussion on
cxx-abi list.

llvm-svn: 371462
2019-09-09 22:26:04 +00:00
Richard Smith 4bbe85c5d4 Implement demangling support for C++20 lambda expression extensions.
This implements demangling support for the mangling extensions specified
in https://github.com/itanium-cxx-abi/cxx-abi/pull/85, much of which is
implemented in Clang r359967 and r371004.

Specifically, this provides demangling for:

 * <template-param-decl> in <lambda-sig>
 * <template-param> with non-zero level
 * lambda-expression literals (not emitted by Clang yet)
 * nullptr literals
 * string literals

(The final two seem unrelated, but handling them was necessary in order
to disambiguate between lambda expressions and the other forms of
literal for which we have a type but no value.)

When demangling a <lambda-sig>, we form template parameters with no
corresponding argument, so we cannot substitute in the argument in the
demangling. Instead we invent synthetic names for the template
parameters (eg, '[]<typename $T>($T *x)').

llvm-svn: 371273
2019-09-06 23:53:21 +00:00
Nico Weber dd8580f437 small follow-up to r368604
llvm-svn: 368605
2019-08-12 19:19:29 +00:00
Nico Weber 086048df04 libcxxabi: Rename .hpp files to .h
LLVM uses .h as its extension for header files.

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

llvm-svn: 368604
2019-08-12 19:11:23 +00:00
Louis Dionne df13b9393d [libc++abi] Fix tests when pstl is enabled
llvm-svn: 368286
2019-08-08 12:43:20 +00:00
Erik Pilkington 9a6cef74d8 [demangle] Support for C++2a char8_t
llvm-svn: 364677
2019-06-28 19:54:19 +00:00
Erik Pilkington cf8c6cfcdc [demangle] Special case clang's creative mangling of __uuidof expressions.
llvm-svn: 363752
2019-06-18 23:34:09 +00:00
Erik Pilkington 65831d0499 [demangle] Vendor extended types shouldn't be considered substitution candidates
llvm-svn: 362983
2019-06-10 21:02:39 +00:00
Louis Dionne e92a9c99d6 [libcxxabi] Add a test for invalid assumptions on the alignment of exceptions
rdar://problem/49864414

llvm-svn: 361039
2019-05-17 14:53:29 +00:00
Eric Fiselier 583df63134 XFAIL test for new GCC version
llvm-svn: 360944
2019-05-16 21:53:33 +00:00
Eric Fiselier a4939d3507 Attempt to fix flaky tests.
The threaded cxa guard test attempted to test multithreaded waiting
by lining up a bunch of threads at a held init lock and releasing them.
The test initially wanted each thread to observe the lock being held,
but some threads may arive too late.

This patch cleans up the test and relaxes the restrictions.

llvm-svn: 359785
2019-05-02 13:22:55 +00:00
Eric Fiselier 43a015ab81 Remove XFail for new GCC. They fixed it
llvm-svn: 359415
2019-04-29 04:47:57 +00:00
Eric Fiselier 5a235865f7 Cleanup new cxa guard implementation.
* Add TSAN annotations around the futex syscalls.
* Test that the futex syscall wrappers actually work.
* Fix bad names.

llvm-svn: 359069
2019-04-24 04:21:05 +00:00
Eric Fiselier 27fd2f60ee Work around GCC test failure.
llvm-svn: 359065
2019-04-24 02:21:13 +00:00
Eric Fiselier 70ebeabfb8 Rewrite cxa guard implementation.
This patch does three main things:
  (1) It re-writes the cxa guard implementation to make it testable.
  (2) Adds support for recursive init detection on non-apple platforms.
  (3) It adds a futex based implementation.

The futex based implementation locks and notifies on a per-object basis, unlike the
current implementation which uses a global lock for all objects. Once this patch settles
I'll turn it on by default when supported.

llvm-svn: 359060
2019-04-24 01:47:30 +00:00
Louis Dionne c86011f5bc [libc++abi] Don't use a .sh.cpp test for uncaught_exception
Otherwise, we don't seem to get the DYLD_LIBRARY_PATH set up correctly
and the tests are run against the system libc++abi dylib.

llvm-svn: 358937
2019-04-23 00:03:34 +00:00
Louis Dionne 549048f390 [libc++] Make sure we re-export some missing libc++abi symbols from libc++
Summary:
Ensure we re-export __cxa_throw_bad_array_new_length and
__cxa_uncaught_exceptions from libc++, since they are now
provided by libc++abi.

Doing this allows us to stop linking explicitly against libc++abi in
the libc++abi tests, since libc++ re-exports all the necessary symbols.
However, there is one caveat to that. We don't want libc++ to re-export
__cxa_uncaught_exception (the singular form), since it's only provided
for backwards compatibility. Hence, for the single test where we check
this backwards compatibility, we explicitly link against libc++abi.

PR27405
PR22654

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 358690
2019-04-18 17:18:15 +00:00
Louis Dionne 2b0da3d63e [NFC] Correct outdated links to the Itanium C++ ABI documentation
Those are now hosted on GitHub.

rdar://problem/36557462

llvm-svn: 358191
2019-04-11 16:37:07 +00:00
Eric Fiselier c4225e124f Fix PR41395 - __cxa_vec_new may overflow in allocation size calculation.
llvm-svn: 357814
2019-04-05 20:38:43 +00:00