Commit Graph

244 Commits

Author SHA1 Message Date
Micah Villmow fb89f27a8f Move TargetData to DataLayout.
llvm-svn: 165397
2012-10-08 16:29:26 +00:00
Howard Hinnant 538fe8f35b Set up code under _LIBCXX_DYNAMIC_FALLBACK which is off by default. For a full description of _LIBCXX_DYNAMIC_FALLBACK, see src/private_typeinfo.cpp.
llvm-svn: 164863
2012-09-28 22:43:50 +00:00
Howard Hinnant 785a8721d2 Improve the diagnostic messages on dynamic_cast.
llvm-svn: 164833
2012-09-28 17:58:48 +00:00
Howard Hinnant 2d0352cbf8 Two changes: 1) I still didn't have the ABI correct to match the gcc-4.2 std::string under the exception classes. I think the changes to stdexcept.cpp have got that down now. 2) On Apple platforms I'm seeing visibility bugs in applications with respect to type_info's being hidden. This is causing dynamic_cast to malfunction because there are multiple type_info's running around for one type within an application, making dynamic_cast believe that one type is actually multiple types. As a stop gap measure I'm trying to detect this error, print out an error message, but continue with the most likely desired result. This is all under __APPLE__. This behavior can be expanded to other platforms if desired.
llvm-svn: 164809
2012-09-28 00:05:34 +00:00
Marshall Clow 8493cad160 Updating email address
llvm-svn: 164490
2012-09-24 14:27:24 +00:00
Howard Hinnant 128ec49e29 Rename class __lambda to __lambda_node to avoid clash with gcc. This fixes http://llvm.org/bugs/show_bug.cgi?id=13889
llvm-svn: 164405
2012-09-21 19:21:37 +00:00
Howard Hinnant ed3d690f68 Tweak use of dlopen to be a little more correct and higher performing.
llvm-svn: 164404
2012-09-21 19:12:56 +00:00
Howard Hinnant e115af2777 I've added Apple-only behavior that looks for libstdc++ in the same process and if found, checks the string stored in <stdexcept> exception objects to see if it is the gcc empty string singleton before manipulating the reference count. This is done so that if such an exception is created with a zero-length string in libstdc++, libc++abi won't try to delete the memory. This is part of a ongoing process to make libc++ exceptions ABI-compatible with libstdc++-4.2 exceptions, to the point that each library can catch exceptions thrown by the other. If other parties would also like this behavior, the #if __APPLE__ can be broadened.
llvm-svn: 164170
2012-09-18 21:34:12 +00:00
Howard Hinnant 6aa048efc9 Specifically disallow primary-expressions of the form LT_... on the basis of this decition: http://sourcerytools.com/pipermail/cxx-abi-dev/2011-August/002422.html . Failure to disallow this was causing infinite recursion in the demangler when these symbols show up due to mangling bugs. This patch causes the demangler to return an invalid mangled name result rather than crash in infinite recursion.
llvm-svn: 163859
2012-09-13 23:49:59 +00:00
Howard Hinnant 2c2b55f27f Change size of reference count field in __libcpp_nmstr from 32 bits to 64 bits for 64 bit targets. This is controls the data layout of all exceptions defined in <stdexcept>. This aligns the ABI with that of gcc-4.2.
llvm-svn: 161496
2012-08-08 16:15:16 +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 3a86b142a1 Update status.
llvm-svn: 161221
2012-08-02 22:06:41 +00:00
Howard Hinnant fdfcfcf670 Update CREDITS.TXT
llvm-svn: 161129
2012-08-01 19:24:04 +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
Howard Hinnant a8c5d770f9 Andrew Morrow: Mainline clang seems to have recently become more strict about the
consistent application of visibility attributes, which causes some new
breakage in libcxxabi:

In file included from src/libcxxabi/src/cxa_default_handlers.cpp:19:
src/libcxxabi/src/private_typeinfo.h:123:23: error: visibility does
not match previous declaration
class __attribute__ ((__visibility__(default))) __class_type_info
                     ^
src/libcxxabi/src/private_typeinfo.h:19:13: note: previous attribute is here
#pragma GCC visibility push(hidden)
           ^
1 error generated.

The forward declaration of __class_type_info is picking up hidden
visibility from the #pragma, which conflicts with the default
visibility applied when the class is later fully declared. I'm
assuming that the full declaration has it right (and that the
diagnostic is correct), so the attached patch applies the default
visibility attribute to the forward declaration.

llvm-svn: 160933
2012-07-29 20:41:19 +00:00
Howard Hinnant 95d917f8ee Andrew Morrow: The variable 't1' on line 10188 of cxa_demangle.cpp is uninitialized
which generates -Wsometimes-uninitialized.  Howard:  The only thing this patch is missing is an update to CREDITS.TXT.

llvm-svn: 160932
2012-07-29 16:14:52 +00:00
Sylvestre Ledru 0527b8f942 add a link to the libc++ website
llvm-svn: 160553
2012-07-20 17:21:42 +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 7f53a5da57 Don't dereference root in __parse_ctor_dtor_name unless it is known to not be null.
llvm-svn: 158556
2012-06-15 21:57:51 +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 9de0b35648 Make __cxa_new_handler un-mangled
llvm-svn: 155763
2012-04-28 16:46:04 +00:00
Howard Hinnant 2a9c509c7e Changed 'cause' from 'terminate' to 'uncaught' in default_terminate_handler
llvm-svn: 155452
2012-04-24 17:41:51 +00:00
Howard Hinnant b54f86aa9d Richard Smith: __int128 is a GNU keyword which clang 3.1 supports. This usage of it as an identifier will need to be renamed.
llvm-svn: 155044
2012-04-18 20:55:06 +00:00
Howard Hinnant e59dbd7b82 I would really like to write the handlers in terms of C++11 atomics. This would give us the best performance, portablity, and safety tradeoff. Unfortunately I can not yet do that. So I've put the desired code in comments, and reverted the handler getters to the slower but safer legacy atomic intrinsics.
llvm-svn: 153041
2012-03-19 16:56:51 +00:00
Howard Hinnant 4ac72dd982 I've moved __cxa_terminate_handler, __cxa_unexpected_handler and __cxa_new_handler from the public header cxxabi.h into the private header cxa_handlers.hpp. During this move I've also moved them from namespace __cxxabiapple into the global namespace. They are, and have always been extern C and so the namespace (or lack of it) does not affect their ABI. In general external clients should not reference these symbols. They are atomic variables and will be changing into C++11 atomic variables in the future. However for those few clients who really need access to them, their name, mangling, size, alignment and layout will remain stable. You just may need your own declaration of them. Include guards have been added to the private header cxa_exception.hpp. The private header cxa_default_handlers.hpp has been removed and the default handlers are now file-static. Include guards have been added to the private header cxa_handlers.hpp.
llvm-svn: 153039
2012-03-19 16:20:34 +00:00
Howard Hinnant 0f73197364 Arm fixes in cxa_personality.cpp and a little refactoring.
llvm-svn: 152966
2012-03-17 00:10:52 +00:00
Dave Zarzycki d6533ccd48 Less lame "concurrency" support
These APIs aren't thread safe, but they're pretending to be. Let's at
least make the getter as fast as they can be. The setters are a lost
cause unless the API can be fixed.

llvm-svn: 152786
2012-03-15 08:58:08 +00:00
Dave Zarzycki 13e35c086c Be friendly to when dead_strip doesn't work
Apple Radar: 11053417

llvm-svn: 152785
2012-03-15 08:58:06 +00:00
Nick Kledzik 778324abe4 move default handlers to their own file so they can be overridden at build time (dyld)
llvm-svn: 152770
2012-03-15 01:52:12 +00:00
Howard Hinnant ffa26667d9 Missed an underscore on the last commit.
llvm-svn: 152736
2012-03-14 19:39:50 +00:00
Howard Hinnant baae2be624 Enable __arm__ on apple
llvm-svn: 152735
2012-03-14 19:30:00 +00:00
Nick Kledzik 37cb6555f0 fix crash log magic
llvm-svn: 152693
2012-03-14 01:16:14 +00:00
Howard Hinnant 3bfc622bdb Enable / silence -Wunused-parameter.
llvm-svn: 152415
2012-03-09 18:01:37 +00:00
Howard Hinnant e6de8df54e Enable -Wstrict-aliasing=2 -Wstrict-overflow=4.
llvm-svn: 152338
2012-03-08 20:55:13 +00:00
Howard Hinnant 8292678017 Enable/silence -Wsign-compare.
llvm-svn: 152336
2012-03-08 20:51:01 +00:00
Howard Hinnant 71c4857a07 Enable/silence -Wsign-compare.
llvm-svn: 152335
2012-03-08 20:50:28 +00:00
Howard Hinnant 37c247c13c Enable/silence -Wmissing-field-initializers.
llvm-svn: 152334
2012-03-08 20:32:50 +00:00
Howard Hinnant 7cafb87441 Enable/silence -Wunused-variable.
llvm-svn: 152329
2012-03-08 20:23:24 +00:00
Howard Hinnant d121eb2c24 Enable/silence -Wconversion.
llvm-svn: 152328
2012-03-08 20:16:45 +00:00
Howard Hinnant 11dd38dab0 Enable/silence -Wshadow.
llvm-svn: 152325
2012-03-08 19:34:58 +00:00
Howard Hinnant 41bcf33c63 Enable/silence -Wsign-conversion.
llvm-svn: 152323
2012-03-08 18:45:24 +00:00
Howard Hinnant 20d6c14c88 First attempt at arm support.
llvm-svn: 151765
2012-02-29 22:14:19 +00:00
Howard Hinnant fdad25a40a Insert a couple of dummy virtual functions to ease low level binary compatibility with other low level tools.
llvm-svn: 151282
2012-02-23 21:09:29 +00:00
Howard Hinnant 2d809ac734 And the handlers should be extern C.
llvm-svn: 151261
2012-02-23 17:25:34 +00:00
Howard Hinnant 49f28b5a47 I had originally made the handler function pointers a static internal detail, not accessible to the outside world. I did this because they must be accessed in a thread-safe manner, and the library provides thread-safe getters and setters for these. However I am at least temporarily making them public and giving them the Apple-extension names. In the future these may disappear again, and I think that would probably be a good idea.
llvm-svn: 151256
2012-02-23 15:32:07 +00:00
Dave Zarzycki 3cd25390e5 Pedantic fix: missing newline at EOF
llvm-svn: 151132
2012-02-22 05:25:00 +00:00
Howard Hinnant 3e7d155768 Move typeinfos for exceptions in <stdexcept> to the abi
llvm-svn: 150834
2012-02-17 19:23:47 +00:00
Howard Hinnant 995fcc0d49 Add (reluctantly) a namespace alias for __cxxabiv1.
llvm-svn: 150828
2012-02-17 18:45:44 +00:00
Howard Hinnant d901bb4de4 Remove outdated information from comment.
llvm-svn: 150827
2012-02-17 18:45:04 +00:00
Howard Hinnant 71cf5ab0d3 __gxx_personality_v0 and __cxa_call_unexpected are complete on darwin and I *think* linux (not positive), but still unimplemented on arm.
llvm-svn: 149711
2012-02-03 20:53:52 +00:00
Howard Hinnant 92afda06d7 Pushed optimization back up. Crash disappeared with compiler upgrade. Assumed to be due to compiler bug.
llvm-svn: 149702
2012-02-03 18:36:36 +00:00
Howard Hinnant 31dea02601 corrected namespace in test
llvm-svn: 149635
2012-02-02 22:00:52 +00:00
Howard Hinnant eaa65afc7b Work on restricting symbol visibility.
llvm-svn: 149633
2012-02-02 20:47:28 +00:00
Howard Hinnant 90ef25c05e Add version number to this library so we can recognize when we're using it.
llvm-svn: 149632
2012-02-02 20:47:05 +00:00
Howard Hinnant 67e5863cd9 There's a crasher I need to track down, occurring at -O0.
llvm-svn: 149631
2012-02-02 20:42:31 +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 30025116de Changed a TODO to a 'maybe some time in the future'.
llvm-svn: 149539
2012-02-01 21:12:07 +00:00
Howard Hinnant 8030b7f751 Removed DEBUG statements.
llvm-svn: 149538
2012-02-01 21:08:30 +00:00
Howard Hinnant 089123e65f Remove a TODO regarding where some can_catch are implemented. I opted to make can_catch pure virtual in the top __shim_type_info, and have each sub-class implement its own. There are some repeated definitions, but they are trivial.
llvm-svn: 149537
2012-02-01 21:06:46 +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 69a10f466b Removing a TODO: can_catch is fundamentally different than search_above_dst. can_catch is looking for an unamiguous public base class of a specific type, but at any address. search_above_dst is looking for an unambiguous public base class of a specific type, *and* at a specific address. Additionally can_catch is run for all types. search_above_dst is only run on class types. So these are only superficially similar. Not similar enough for resuse, at least without making the code unreadable.
llvm-svn: 149522
2012-02-01 18:52:35 +00:00
Howard Hinnant d0bfbb336f Teach exception_cleanup_func about dependent exceptions.
llvm-svn: 149520
2012-02-01 18:44:21 +00:00
Howard Hinnant 8aa78517ab Treat all exceptions except that the ones that this library throws as foreign. Even other C++ exceptions.
llvm-svn: 149518
2012-02-01 18:15:15 +00:00
Howard Hinnant 62efe0b062 Nothing but polishing comments.
llvm-svn: 149515
2012-02-01 16:56:40 +00:00
Howard Hinnant 4ca103d14c Move an error detector to a better place.
llvm-svn: 149513
2012-02-01 16:16:11 +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 310fcc749d Back the optimization down from -O3 to -Os. I'm getting an unexplained crasher on -O3. I've looked for a libc++abi bug and can't find one. I'm suspecting clang optimizer bug. But I don't have a good test case at the moment. Deferring investigation on this for now as I will soon be developing more and smaller tests.
llvm-svn: 149414
2012-01-31 20:22:59 +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 fe2052d635 Have the default unexpected/terminate handler output *demangled* names for the type of exception instead of the mangled name.
llvm-svn: 149409
2012-01-31 19:48:06 +00:00
Howard Hinnant 43f5fecdb5 Fix type-o in the comment of the last commit
llvm-svn: 149403
2012-01-31 19:05:08 +00:00
Howard Hinnant 6351792447 Found and fixed a bug in __cxa_call_unexpected. If the unexpected_handler rethrows the same exception then needed information gets overwritten in the original exception header. Therefore save it locally before executing the unexpected_handler.
llvm-svn: 149400
2012-01-31 18:57:20 +00:00
Howard Hinnant d96cac1282 Found and fixed bug in personality function: Don't dive into the action table if the action entry is zero.
llvm-svn: 149389
2012-01-31 17:15:14 +00:00
Howard Hinnant d6d4c25ef0 Minor bug fix in __cxa_call_unexpected. Changed std::terminate to detect a caught-but-unhandled exception, and choose the handler out of that if found.
llvm-svn: 149329
2012-01-31 01:51:15 +00:00
Howard Hinnant c9204f6bed Refactored personality function. Found one bug in scanning exception spec lists.
llvm-svn: 149272
2012-01-30 20:16:21 +00:00
Howard Hinnant 2c50972c32 Removed debugging print statements
llvm-svn: 149271
2012-01-30 20:13:37 +00:00
Howard Hinnant 47cb854818 Add a descriptive name for a constant. Also I'm at least temporarily waging war on throw specs, both old and new style. Except where we have already publicly exposed the throw spec, I'm getting rid of them. They may come back later. But they seem somewhat prone to cyclic dependencies here. The throw spec implies compiler generated code that this library has to jump to during stack unwinding. I'd like to minimize the possiblity that the code used to properly make that jump is itself creating such jumps.
llvm-svn: 149251
2012-01-30 16:07:00 +00:00
Howard Hinnant 3f0d2384aa Add -fstrict-aliasing -Wstrict-aliasing and change optimization from -Os to -O3
llvm-svn: 149250
2012-01-30 16:03:23 +00:00
Howard Hinnant 5bbc597f1e Put throw() clauses back on these functions in cxxabi.h. This header must be C++03 compatible and these throw specs are consistent with the current cxxabi.h that Apple ships.
llvm-svn: 149249
2012-01-30 16:02:11 +00:00
Howard Hinnant 9aa4684fbb Minor updates to a couple of comments.
llvm-svn: 149158
2012-01-28 00:34:46 +00:00
Howard Hinnant ece71ead6d Add a little paranoia for testing purposes.
llvm-svn: 149157
2012-01-28 00:32:31 +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 ad048719a7 Sometimes it takes all day to write a decent comment. This is one of those times, and I'm still not quite sure I have them correct.
llvm-svn: 149154
2012-01-28 00:28:31 +00:00
Howard Hinnant 113cf60e0b These commits are intended to be temporary in nature and are to facilitate the testing of libc++abi.dylib at this point in time.
llvm-svn: 148967
2012-01-25 19:27:42 +00:00
Howard Hinnant db97064263 Add comment documenting extension behavior of __cxa_get_globals_fast().
llvm-svn: 148966
2012-01-25 19:19:13 +00:00
Howard Hinnant 5d6b9d28f7 cxa_guard.cpp didn't quite make it on the last commit: Restricted headers to cxa_guard.cpp and abort_messsage.h, and added a comment regarding reentrancy brought up by John McCall. Thanks John.
llvm-svn: 148965
2012-01-25 19:02:40 +00:00
Howard Hinnant 2449538500 Restricted headers to cxa_guard.cpp and abort_messsage.h, and added a comment regarding reentrancy brought up by John McCall. Thanks John.
llvm-svn: 148963
2012-01-25 18:50:55 +00:00
Howard Hinnant abc770690a By changing all of the throw() specs to noexcept I've been able to compile and link all of the source files into a dylib. Prior to this substitution the changed functions were calling __cxa_call_unexpected which isn't implemented yet. However in none of these cases do we actaully want __cxa_call_unexpected to be called. Primative buildit script added.
llvm-svn: 148880
2012-01-24 23:42:30 +00:00
Howard Hinnant 7fdfd5d269 Add some needed symbols in exception.cpp and eliminate dependence upon uncaught_exception() from cxa_vector.cpp. libc++abi is very nearly a self-contained (though not complete) library now.
llvm-svn: 148866
2012-01-24 21:48:10 +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 421bbe5cc5 Add some needed symbols to cxa_new_delete.cpp and put the display() stuff under #DEBUG (again).
llvm-svn: 148860
2012-01-24 21:35:18 +00:00