Commit Graph

114 Commits

Author SHA1 Message Date
Marshall Clow 604de5c256 Implement uncaught_exceptions() to get a count, rather than a bool. Update the libc++abi version. Reviewed as http://reviews.llvm.org/D10067
llvm-svn: 238827
2015-06-02 13:03:17 +00:00
Eric Fiselier 65ace9daa3 Disallow conversions from function pointers to void*.
Function pointers and member function pointers cannot be converted to void*.
libc++abi incorrectly allows this conversion for function pointers.

Review URL: http://reviews.llvm.org/D8811

llvm-svn: 236299
2015-05-01 01:49:37 +00:00
Saleem Abdulrasool ac18e0639f libc++abi: move tests back
These are apparently related to libc++'s unwind personality handler and not
unwind core.  Move them back to the correct location.

llvm-svn: 235765
2015-04-24 20:20:54 +00:00
Saleem Abdulrasool a01b1afad4 libc++abi: remove the duplicated unwind content
The unwinder has been moved into its own project setup at
http://svn.llvm.org/projects/libunwind/trunk.  This simply removes the now
duplicated content.  This move was previously discussed on llvmdev at [1].

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-January/081507.html

llvm-svn: 235759
2015-04-24 19:40:31 +00:00
Eric Fiselier b6030b9dbf [libcxxabi] Disallow Base to Derived conversions for catching pointers to members.
Summary:
I accidentally implemented the 4.11 [conv.mem] conversions for libc++abi in a recent patch. @majnemer pointed out that 5.13 [except.handle] only allows the pointer conversions in 4.10 and not those is 4.11. This patch no longer allows the following example code:

```c++
struct A {};
struct B : public A {};

int main() {
  try {
    throw (int A::*)0;
  } catch (int B::*) {
    // exception caught here.
  }
}
```

Reviewers: mclow.lists, jroelofs, majnemer

Reviewed By: majnemer

Subscribers: majnemer, cfe-commits

Differential Revision: http://reviews.llvm.org/D8845

llvm-svn: 234254
2015-04-06 23:03:01 +00:00
Eric Fiselier 1b00fc5d81 [libcxxabi] Fix multi-level pointer conversions and pointer to member conversion detection.
Summary:
Currently there are bugs in out detection of multi-level pointer conversions and pointer to member conversions. This patch fixes the following issues.

* Allow multi-level pointers with different nested qualifiers.
* Allow multi-level mixed pointers to objects and pointers to members with different nested qualifiers.
* Allow conversions from `int Base::*` to `int Derived::*` but only for non-nested pointers.

There is still some work that needs to be done to clean this patch up but I want to get some input on it.
Open questions:

* Does `__pointer_to_member_type_info::can_catch(...)` need to adjust the pointer if a base to derived conversion is performed?


Reviewers: danalbert, compnerd, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8758

llvm-svn: 233984
2015-04-02 23:26:37 +00:00
Eric Fiselier cf74f5d20b Let libc++'s LIT configuration setup our linker paths and env.
llvm-svn: 232529
2015-03-17 19:45:21 +00:00
Eric Fiselier 4260252222 add option to tell LIT where to find the libc++ library when built out of tree
llvm-svn: 232518
2015-03-17 18:58:14 +00:00
Eric Fiselier 14dbeaadc1 [libcxxabi] Build both static and shared versions of libc++abi by default.
Summary:
This patch builds both static and shared versions of libc++abi by default. It adds/repurposes the following cmake options:
* `LIBCXXABI_ENABLE_SHARED`: Enable/disable building the shared library. (Previously using `OFF` would build the static library instead)
* `LIBCXXABI_ENABLE_STATIC`: Enable/disable building the static library.

This patch also re-purposes the CMake target `cxxabi` to be a meta-target for `cxxabi_shared` and `cxxabi_static`. This could potentially break other builds that depend on `cxxabi` being a library target. We will need to apply a patch to libc++'s CMake before committing this change. 

Running the tests is still only supported when the shared version is built. Support for running the tests against the static library will come in another patch.


Reviewers: jroelofs, mclow.lists, danalbert, compnerd

Reviewed By: danalbert, compnerd

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8013

llvm-svn: 231075
2015-03-03 15:59:09 +00:00
Jonathan Roelofs 0b57fc3147 Add remote testing support to the lit config
Now that the corresponding support in libcxx has landed (r230592), adding
support here is pretty simple.

llvm-svn: 230643
2015-02-26 15:55:01 +00:00
Eric Fiselier 64cfdfea5a Add temporary workaround for missing symbol __cxa_throw_bad_new_array_length on OS X.
llvm-svn: 230125
2015-02-21 04:30:36 +00:00
Eric Fiselier 1dfbfb8c9e Fix libcxxabi's library and object root for tests.
llvm-svn: 228779
2015-02-11 01:07:48 +00:00
Eric Fiselier 879d18bf4e Make test require 'linux' instead of 'linux2'
llvm-svn: 228073
2015-02-03 23:50:47 +00:00
Eric Fiselier 753f7c306b [libcxxabi] Teach CMake better ways to find the libc++ source directory (and misc cleanup).
Summary:
The main section of this patch teaches CMake  a new option `LIBCXXABI_LIBCXX_PATH` that specifies the path to the libcxx source root. This information is passed to lit so that it can better find libc++'s python module. `LIBCXXABI_LIBCXX_PATH` is also used to help find the libc++ headers.

The rest of this patch is misc cleanup, mostly to make pep8 and pylint happy.
I've also copied libc++'s .gitignore into libc++abi.



Reviewers: jroelofs, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7130

llvm-svn: 226855
2015-01-22 20:00:06 +00:00
Logan Chien 957fd4d1d3 Enable backtrace_test for ARM.
llvm-svn: 226824
2015-01-22 13:40:16 +00:00
Jonathan Roelofs fcf053b342 Merge libc++abi's lit configuration with libc++'s
http://reviews.llvm.org/D6985

llvm-svn: 226737
2015-01-21 23:06:22 +00:00
Jonathan Roelofs e434b34fa3 Rename all of the tests in preparation for merging lit configs with libcxx
http://reviews.llvm.org/D7101

llvm-svn: 226691
2015-01-21 19:05:37 +00:00
Chandler Carruth 24a6b05680 [cmake/multilib] Teach libc++abi's CMake build to support multilib
libdir suffixes like 'lib64' or 'lib32'.

This support is currently very rhudimentary. We define a variable
LIBCXXABI_LIBDIR_SUFFIX. In a standalone build of libc++abi this can be
directly set as a cached variable to control the multilib suffix used.
When building libc++abi within a larger LLVM build, it is hard wired to
whatever LLVM libdir suffix has been selected. If this doesn't work for
someone, just let me know. I'm happy to change it.

Unfortunately, libc++abi's lit setup made this somewhat problematic to
change. It was setting variables up in a way that caused the resulting
build to not work with lit at all. To fix that, I've moved some
variables around in the CMake build to more closely match where and how
they are defined in the libc++ CMake build. This includes specifically
defining a library root variable in the CMake build where the libdir
suffix can be applied, and then using that rather than re-computing it
from the object directory in the lit config.

This is essentially new functionality for libc++abi so I don't expect it
to have any impact for folks until they start setting these variables.
However, I know libc++abi is built in a diverse set of environments so
just let me know if this causes you any problems.

llvm-svn: 224927
2014-12-29 12:22:04 +00:00
Dan Albert 12c0c8b67f [libcxxabi] Add __cxa_thread_atexit for TLS support on Linux.
Summary:
Fixes PR21738.

The implementation for this is handled by __cxa_thread_atexit_impl,
which is supplied by libc.

More information:
https://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables

Reviewers: mclow.lists, EricWF, jroelofs

Reviewed By: jroelofs

Subscribers: majnemer, cfe-commits

Differential Revision: http://reviews.llvm.org/D6708

llvm-svn: 224477
2014-12-18 00:03:57 +00:00
Justin Bogner 035b964d72 Use the newer python syntax for exceptions
We've dropped support for python 2.5, so now we can use the forward
compatible "except ... as" syntax.

llvm-svn: 224182
2014-12-13 02:49:27 +00:00
Eric Fiselier eae1b6a6d7 Fix comment on end of #endif to match #if
llvm-svn: 222719
2014-11-25 03:19:02 +00:00
Eric Fiselier 17b1568fc4 Use lit.util.executeCommand instead of our own version
llvm-svn: 222718
2014-11-25 03:06:31 +00:00
Eric Fiselier 559f867af2 [libcxxabi] Refactor building and testing libc++abi without threads
Summary:
This patch adds CMake support for building and testing libc++abi without threads. 


1. Add `LIBCXXABI_ENABLE_THREADS` option to CMake.
2. Propagate `LIBCXXABI_ENABLE_THREADS` to lit via lit.site.cfg.in
3. Configure tests for `LIBCXXABI_ENABLE_THREADS=OFF

Currently the test suite does not work when libc++abi is built without threads because that information does not propagate to the test suite.



Reviewers: danalbert, mclow.lists, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6393

llvm-svn: 222702
2014-11-24 22:42:03 +00:00
Eric Fiselier c5de7b113b [libcxxabi] Refactor test timing logic and disable by default.
Summary:
When using LIT the timing output is entirely unused but introduces a dependency on `<chrono>`. When libc++ is built without a montonic clock this causes some of the tests to fail.
This patch factors out all of the timing logic into `support/timer.hpp` and disables it by default. To enable the timing you must define `LIBCXXABI_TIME_TESTS`.



Reviewers: mclow.lists, danalbert, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6391

llvm-svn: 222701
2014-11-24 22:38:57 +00:00
Eric Fiselier 5c24658328 Ensure llvm-sanitizer is found by the tests when using sanitizers.
llvm-svn: 222496
2014-11-21 02:16:19 +00:00
Eric Fiselier a315865759 [libcxxabi] Cleanup memory in tests to placate ASAN.
Summary: ASAN fires on these tests because they don't clean up their memory.

Reviewers: danalbert, jroelofs, mclow.lists

Reviewed By: jroelofs

Subscribers: dblaikie, cfe-commits

Differential Revision: http://reviews.llvm.org/D6281

llvm-svn: 222493
2014-11-21 01:53:51 +00:00
Eric Fiselier ef2ad33e8a Add support for LLVM_USE_SANITIZER=Thread to test suite
llvm-svn: 222260
2014-11-18 21:28:49 +00:00
Eric Fiselier 00616f1039 Add -g -fno-omit-frame-pointer when compiling tests with sanitizers
llvm-svn: 222053
2014-11-14 22:27:43 +00:00
Renato Golin d4ac2ba618 Move ARM failure from FIXME to XFAIL
llvm-svn: 221515
2014-11-07 10:30:53 +00:00
Eric Fiselier 4dfba103a7 Add support for UNSUPPORTED tag to lit
llvm-svn: 221460
2014-11-06 15:26:20 +00:00
Renato Golin c560b365a0 Disable backtrace libcxxabi test on ARM
_Unwind_Backtrace is not clearly defined in EHABI and needs more
testing. A bug was created with some initial investigation done
http://llvm.org/PR21444. This test fails with both libunwind and libgcc_s.

llvm-svn: 221348
2014-11-05 14:45:46 +00:00
Eric Fiselier 5a5fadd70d Change uses of `sys.platform == 'linux2' to `sys.platform.startswith('linux')
Although the current method is valid up till python 3.3 (which is not supported)
this seems to be a clearer way of checking for linux and moves the tests towards
python 3 compatibility.

llvm-svn: 220535
2014-10-23 23:05:46 +00:00
Eric Fiselier 17bb2118d2 Only link the tests against -ldl on linux
llvm-svn: 220509
2014-10-23 20:44:25 +00:00
Eric Fiselier 78d325c143 [libcxxabi] Add support for running libc++abi tests with sanitizers
Summary: Add support for LLVM_USE_SANITIZER to the libc++abi tests. Currently, if libc++abi is configured with LLVM_USE_SANITIZER then none of the tests will pass.

Reviewers: jroelofs, mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5926

llvm-svn: 220464
2014-10-23 03:10:43 +00:00
Aaron Ballman eb7c1a6e50 Adding ABI support for __cxa_throw_bad_array_new_length.
llvm-svn: 217604
2014-09-11 17:26:43 +00:00
Jonathan Roelofs 3b7f085db1 s/LIBCXXABI_SINGLE_THREADED/LIBCXXABI_HAS_NO_THREADS/ for consistency with libcxx
Also remove the audotedection part so that if you're crazy enough to want a
single-threaded abi library, you'll say so explicitly in the build.

llvm-svn: 217262
2014-09-05 17:46:40 +00:00
Dan Albert e5f15210fb Add missing include to a test case.
Some platforms get size_t defined transitively by another include, but
Android does not.

llvm-svn: 216738
2014-08-29 16:09:32 +00:00
Dan Albert 2c012d495d Make _Unwind_Backtrace() work on ARM.
Summary: Since the personality functions do the actual unwinding on ARM,
and will also stop unwinding when they encounter a handler, we invoke
_Unwind_VRS_Interpret() directly form _Unwind_Backtrace().

To simplify, the logic for decoding an EHT is moved out of
unwindOneFrame() and into its own function, decode_eht_entry(). Unlike
unwindOneFrame(), which could only handle ARM's compact personality
function entries (section 6.3) decode_eht_entry() can handle the generic
entries (section 6.2).

Reviewers: jroelofs

Reviewed By: jroelofs

Subscribers: piman, aemerson, cfe-commits

Differential Revision: http://reviews.llvm.org/D5112

llvm-svn: 216730
2014-08-29 15:26:06 +00:00
Dan Albert 7c06819ecd Add support for building and testing the unwinder.
Note: The unwinder currently only works on Darwin and on ARM Linux.
Non-ARM Linux support is not yet implemented, and will fail to build.

llvm-svn: 212824
2014-07-11 15:36:02 +00:00
Dan Albert a770f9d66b Add lit configs for libcxxabi tests.
This makes running libcxxabi tests on Linux _much_ easier.
Adds a check-libcxxabi target to cmake.

Also defaults to building a dynamic libc++abi. This is so that the
default options still test the libc++abi that is being built. There are
two problems with testing a static libc++abi. In the case of a
standalone build, the tests will link the system's libc++, which might
not have been built against our libc++abi. In the case of an in tree
build, libc++ will prefer a dynamic libc++abi from the system over a
static libc++abi from the output directory.

llvm-svn: 212672
2014-07-10 02:20:11 +00:00
Jonathan Roelofs 72a15cda3f Add test case for inherited exceptions
Test case written by Dana Jansens.

llvm-svn: 210129
2014-06-03 21:50:11 +00:00
Jonathan Roelofs 20f6f45c5b Add EH test case checking that handlers in noexcept functions can still unwind
llvm-svn: 209944
2014-05-31 00:25:59 +00:00
Jonathan Roelofs 75fd1b5f51 Add EH test cases corresponding to C++ ABI # 15.3.3
llvm-svn: 209943
2014-05-31 00:24:58 +00:00
Richard Smith bd32a449e6 PR19091: Track whether we're demangling a function template specialization to
determine whether we get a mangling for a return type, rather than trying to
figure it out based on whether the mangled name ended with a '>'.

llvm-svn: 208611
2014-05-12 18:44:13 +00:00
Logan Chien dc65ab4cef Implement ARM EHABI exception handling.
This commit implements the ARM zero-cost exception handling
support for libc++abi.

llvm-svn: 208466
2014-05-10 00:42:10 +00:00
Logan Chien cc24fc546b Check exception specification with __cplusplus.
To allow the compilation with gcc, we can't use the
__has_feature(cxx_noexcept) to detect the default destructor
exception specification, which is noexcept(true) by default
in C++11.  We should use __cplusplus >= 201103L instead.

llvm-svn: 208465
2014-05-10 00:40:54 +00:00
Jonathan Roelofs 40e9842854 On single threaded systems, turn mutexes into nops
http://reviews.llvm.org/D3386

llvm-svn: 208135
2014-05-06 21:30:56 +00:00
Joerg Sonnenberger c72473d87b Try harder to get the compiler to use float registers in different
places to increase the chance of messing up any preserved registers.

llvm-svn: 207938
2014-05-04 16:31:33 +00:00
Joerg Sonnenberger e9a72d54c7 Don't use bash features.
llvm-svn: 207907
2014-05-03 12:09:55 +00:00
Nick Kledzik 326254f422 Add unwind test case that checks restoring of float registers (such as on AArch64)
llvm-svn: 207481
2014-04-29 01:08:23 +00:00