Commit Graph

194 Commits

Author SHA1 Message Date
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
Anders Carlsson 3e107b3bd8 Demangle Dc to decltype(auto) as per the Itanium C++ ABI spec.
llvm-svn: 201533
2014-02-17 21:56:01 +00:00
Marshall Clow d230a3d1f6 Fix PR17221 - can't catch virtual base classes when throwing derived NULL pointers. Specifically, libc++abi would crash when you tried it.
llvm-svn: 200904
2014-02-06 04:47:02 +00:00
Marshall Clow 176be6fed5 Fix PR17222 - catching derived classes from thrown null pointer. Adds tests, too
llvm-svn: 200864
2014-02-05 18:19:57 +00:00
Howard Hinnant 5a7b4ca21e Implement demangling for user-defined operators.
llvm-svn: 198643
2014-01-06 23:05:04 +00:00
Howard Hinnant 14fe17f302 Fix demangling crasher. The crasher involved nested <encoding> involving parameter packs, which exposed a logic bug causing an empty vector<string> to be accessed with back(). In addition to fixing the bug, I've inserted numerous preemptive checks for similar bugs in the hopes that if another bug is uncovered, the bug results in an invalid mangled string instead of a demangler crash. Test suite updated with string that was causing the crash.
llvm-svn: 197063
2013-12-11 19:44:25 +00:00
Nico Weber 6ceed44db4 80-column wrap a comment in a test
llvm-svn: 196540
2013-12-05 21:54:49 +00:00
Marshall Clow 350bda6eb2 Fixed a couple of test errors; changed 'const A const *' to 'const A* const'. Thanks to Nico for the catch
llvm-svn: 196355
2013-12-04 05:39:55 +00:00
Howard Hinnant b162939c1a tip-of-trunk clang has corrected some access checks for special members in a virtual inheritance hierarchy. Change a few private inheritances to protected. This change will not impact what the test was testing. This fixes http://llvm.org/bugs/show_bug.cgi?id=16753.
llvm-svn: 187429
2013-07-30 19:00:45 +00:00
Howard Hinnant 60c16eb7f5 I'd no sooner made the last commit when Matthew Dempsky sent me another test case that led me to yet another closely related test case that the current design could not handle. I've now changed the way forward references are handled completely. It wasn't that much code to change. The demangler, when confronted with a forward reference to a template parameter, now parses things twice. During the second parse, all forward references are remembered from the first parse. Test suite updated with new case.
llvm-svn: 184672
2013-06-23 19:52:45 +00:00
Howard Hinnant cde9e006d8 After a private conversation with Arthur O'Dwyer, and a good night's sleep, I believe this fix is a better fix than what I committed in r184656 yesterday. I've basically moved the checking for '`' from the start of the demangling process to the end of it. In the process I discovered that one of the test cases no longer demangled to the expected string. After further investigation I believe this case to not be a valid mangled string, and so I moved the test case to the 'invalid cases'. The reason I believe it is invalid is that it should use T_ instead of T0_ to index the template parameter.
llvm-svn: 184668
2013-06-23 17:14:35 +00:00
Howard Hinnant ae10f9d45e Filter out '`' in mangled strings and reject them as invalid if found.
llvm-svn: 184656
2013-06-23 03:36:38 +00:00
Howard Hinnant 72a54eab35 I created a random mangled name generator and have thrown about 200 million random strings at the demangler. I succeeded in crashing it twice more and those crashers have been fixed and the test suite updated with the crash cases.
llvm-svn: 184562
2013-06-21 17:04:24 +00:00
Howard Hinnant 8935442538 Another demangler crasher. Updated test suite to prevent regression.
llvm-svn: 184477
2013-06-20 21:49:34 +00:00
Howard Hinnant 763e591461 Protect against invalid mangled names. Add test suite for invalid mangled names.
llvm-svn: 184394
2013-06-20 01:55:07 +00:00
Howard Hinnant b076753454 Demangle objc mangling implemented in r184250
llvm-svn: 184301
2013-06-19 13:43:18 +00:00
Howard Hinnant 862c4a06ee Demangler update: This now demangles many more (all?) C++11 symbols. Demangler tests updated.
llvm-svn: 184097
2013-06-17 18:10:34 +00:00
Howard Hinnant f2ca35cd79 Add capability to demangle invocation functions for ObjC blocks.
llvm-svn: 179208
2013-04-10 19:44:03 +00:00
Howard Hinnant c1c87c15f2 __list::ends_with_template was giving the wrong answer for empty lists. And __parse_unnamed_type_name wasn't properly handling the list of paramters and was not safe against incorrectly mangled lambdas (running past last).
llvm-svn: 169022
2012-11-30 18:43:50 +00:00
Micah Villmow fb89f27a8f Move TargetData to DataLayout.
llvm-svn: 165397
2012-10-08 16:29:26 +00:00
Howard Hinnant 757640b156 Fixes apple: #12020687. This was a problem in the demangler with template
substitution forward references.  That is, sometimes a mangled name refers to
a substitution that hasn't yet been defined.  The demangler was derferencing a
null pointer in this case because it wasn't properly guarded against a
forward reference.  Test case added to catch this problem.

llvm-svn: 161267
2012-08-03 22:02:07 +00:00
Howard Hinnant b2a9cee678 Erik Olofsson: This patch adds support for lambda demangling. I fixed this because it crashed lldb when it tried to demangle the added test.
Not sure how it should identify the lambda so that might need changing from the current 'lambdax'::  Howard:  Please patch CREDITS.TXT.

llvm-svn: 161125
2012-08-01 18:56:46 +00:00
Richard Smith 4c50ea27bf Add missing #include <stdlib.h> into test which uses ::exit.
llvm-svn: 160039
2012-07-11 09:37:56 +00:00
Howard Hinnant ba2e8aeda5 Fix bug in cxa_demangle involving template substitution.
llvm-svn: 155994
2012-05-02 15:38:11 +00:00
Howard Hinnant 31dea02601 corrected namespace in test
llvm-svn: 149635
2012-02-02 22:00:52 +00:00
Marshall Clow a27b0cd8ee added const nullptr tests
llvm-svn: 149552
2012-02-01 22:27:24 +00:00
Marshall Clow e71ddf2fcb removed duplicated tests - Howard was quicker than me.
llvm-svn: 149545
2012-02-01 21:49:28 +00:00
Marshall Clow 62e0f4abf6 Added tests for catching const/non-const nullptr
llvm-svn: 149542
2012-02-01 21:37:24 +00:00
Howard Hinnant 60eaa49036 Add test for pointer qualification conversion.
llvm-svn: 149541
2012-02-01 21:25:40 +00:00
Howard Hinnant c325fa7705 Add some tests to test catching nullptr with pointers and member pointers. Tests are only activated if #if __has_feature(cxx_nullptr).
llvm-svn: 149536
2012-02-01 21:01:52 +00:00
Howard Hinnant 2d6810fbd6 Quash a TODO related to catching pointer-to-member. These tests fail on my copy of gcc-4.2. But I believe the tests to be correct (and they pass for libc++abi). I've enquired on the C++ standards mailing list for a clarification in case I'm wrong. So far I've gotten one response that agrees with me.
llvm-svn: 149534
2012-02-01 20:53:21 +00:00
Howard Hinnant a21f8c2acf Quash TODO regarding catch by function type. Add tests to back it up.
llvm-svn: 149530
2012-02-01 19:42:45 +00:00
Howard Hinnant 26ffb64177 Quash TODO regarding catch by array type. Add tests to back it up.
llvm-svn: 149527
2012-02-01 19:21:28 +00:00
Howard Hinnant 3b22c6c395 Here's a test for catching pointers.
llvm-svn: 149459
2012-02-01 00:22:38 +00:00
Howard Hinnant 372e2f4bd4 More test cases concentrating on catching class types.
llvm-svn: 149453
2012-01-31 23:52:20 +00:00
Howard Hinnant eedecf51bb Some unwinding test cases
llvm-svn: 149436
2012-01-31 21:58:58 +00:00
Howard Hinnant 3d97931a86 Drop the stress a notch on dynamic_cast_stress.cpp. Otherwise it occasionally causes clang to crash. Put a noexcept(false) on a throwing destructor in test_vector1.cpp. The test now passes for both C++03 and C++11 modes. Add testit script. All tests are now PASSING :-)
llvm-svn: 149413
2012-01-31 20:10:33 +00:00
Howard Hinnant f8d292eb08 Correct test bug.
llvm-svn: 149412
2012-01-31 20:01:06 +00:00
Howard Hinnant 805036cc83 Minor header fixups for test.
llvm-svn: 149156
2012-01-28 00:30:38 +00:00
Howard Hinnant 44e3703639 Silence a warning.
llvm-svn: 149155
2012-01-28 00:29:27 +00:00
Howard Hinnant 73ab1864ef Marshall Clow reminded me that fallback_malloc.cpp was broken out for testing purposes. We've agreed to simply rename fallback_malloc.cpp to fallback_malloc.ipp. Thanks Marshall.
llvm-svn: 148863
2012-01-24 21:41:27 +00:00
Howard Hinnant 242566e552 Change header to generic, instead of implementation specific
llvm-svn: 148646
2012-01-22 01:19:20 +00:00
Howard Hinnant b24c9441d1 One more small optimization: Where possible, for loops that do a search and then try to break out of the loop early, eliminate the attempt to break out of the loop after the last search. And with that, I'm declaring __dynamic_cast done. Though if anyone sees any problems, has suggestions for improvements, or wants to contribute some test cases, that is certainly welcome feedback.
llvm-svn: 148246
2012-01-16 18:21:05 +00:00
Howard Hinnant 44a2895a03 Comment smithing. Changed some casts from C-style to C++. And added timings to all of the tests.
llvm-svn: 148241
2012-01-16 17:06:51 +00:00
Howard Hinnant 77fb8ab9f2 I think this is getting close on __dynamic_cast. There's been quite a bit of code rearrangement, renaming, and better commenting. This exercise has exposed and fixed a few more bugs. I've also added several more tests (there's definitely a need for more tests here).
llvm-svn: 148227
2012-01-16 00:13:46 +00:00
Howard Hinnant 50f7eeec9d Enclosed is a stress test for dynamic_cast. It stresses both libc++abi, and clang itself. It creates a ridiculously large class hierarchy using variadic templates. You can specify both the width and depth of the class hierarchy. And you can specify whether the cast is to the actual run time type, or to an intermediate layer in the class. About 1/3 of the time I compile this, it crashes the compiler. There seems to be an uninitialized area of memory, and I'm probably blowing past an assumption on class hierarchy size within clang (and understandably so). I can get it work most of the time with a class hierarchy width of 20 and a depth of 7. I'm making timings with both -O3 and -Os, using both cast to root and cast to intermediate, on both libc++abi, and gcc's dynamic_cast. I've put the results in a comment/table at the bottom of the test.
llvm-svn: 148083
2012-01-13 01:22:31 +00:00
Howard Hinnant b1ca881191 Oops, forgot to svn add the new test.
llvm-svn: 148047
2012-01-12 21:08:25 +00:00
Howard Hinnant b7d59ec6e1 Put debug print statments under a flag so that I can get a first glimpse at performance. So far I haven't noticed any performance difference between this new __dynamic_cast and gcc's implementation. But I've barely started looking. Also adding a couple of tests which come straight out of the standard.
llvm-svn: 148046
2012-01-12 21:06:12 +00:00
Howard Hinnant af07bfdb67 Fixed a couple of bugs, updated many comments, and am including a comprehensive test for when there are only 3 types in place. I need to do something similar for 4 and maybe more types, but I'm not sure how comprehensive I can make the test at 4 and above types.
llvm-svn: 148038
2012-01-12 19:48:14 +00:00
Howard Hinnant bf8a39bb94 Fixed several bugs, implemented support for vector types, and cleaned out dead code.
llvm-svn: 146677
2011-12-15 20:02:15 +00:00
Howard Hinnant 7a084fdd39 Fix size calculation for pointer to member function
llvm-svn: 146463
2011-12-13 01:23:16 +00:00
Howard Hinnant 8de583abf2 Added support for <special-name> ::= TC <first type> <number> _ <second type> # construction vtable for second-in-first, and for <special-name> ::= GR <object name> # reference temporary for object
llvm-svn: 146274
2011-12-09 20:07:56 +00:00
Howard Hinnant 987afbeede Add/update copyright notices
llvm-svn: 145949
2011-12-06 18:01:47 +00:00
Howard Hinnant dc82cca6bf Updated heuristic regulating small string buffer
llvm-svn: 145543
2011-12-01 00:08:59 +00:00
Howard Hinnant 26a9d23657 demangler: Drop preceeding () from function types, but not from pointers and references to function types
llvm-svn: 137469
2011-08-12 17:33:10 +00:00
Marshall Clow e2dcb75b2e Memory manangement routines for exception objects
llvm-svn: 135587
2011-07-20 15:04:39 +00:00
Marshall Clow 1df50ca6a2 Exception handling stuctures, and thread-local variables for exception handling
llvm-svn: 135586
2011-07-20 14:53:53 +00:00
Howard Hinnant 471e111324 In cxa_demangle.cpp, rewrite __parse_unresolved_name to reflect updated understanding and sync with updated clang mangling. Also fix think-o in __parse_encoding enabling the parsing of trailing .eh and .b.
llvm-svn: 133632
2011-06-22 19:27:39 +00:00
Marshall Clow 92091dbe41 Clean up the vector tests
llvm-svn: 132921
2011-06-13 17:57:10 +00:00
Marshall Clow 280ddee8bd Implement vector new and delete functionality
llvm-svn: 132832
2011-06-10 03:40:19 +00:00
Howard Hinnant 575498b52f tabs to spaces
llvm-svn: 132729
2011-06-07 19:56:49 +00:00
Nick Lewycky 6fde150697 Add more tests for cxa_guard methods. This includes our first two tests using
actual threads!

There's no build file for libcxxabi, so I'll tell you that I built it with this:
$ g++-4.6 -pthread -std=gnu++0x test_guard.cpp ../src/cxa_guard.o -o test_guard

llvm-svn: 132644
2011-06-04 18:01:24 +00:00
Marshall Clow f8da5b22af Tests for bad_typeid and bad_cast
llvm-svn: 132545
2011-06-03 13:54:37 +00:00
Howard Hinnant 4a88971ac1 Introduce cxa_virtual.cpp and cxa_guard.cpp. Contributed by Nick Lewycky, Howard Hinnant and John McCall
llvm-svn: 132009
2011-05-24 22:01:16 +00:00
Howard Hinnant d3da57f99b initial import
llvm-svn: 130921
2011-05-05 15:27:28 +00:00