summaryrefslogtreecommitdiffstats
path: root/libcxxabi/src/cxa_exception.cpp
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2011-12-12 19:11:42 +0000
committerHoward Hinnant <hhinnant@apple.com>2011-12-12 19:11:42 +0000
commit58926c9a9b539b62b954af1301c65b293d9b413e (patch)
tree942e66f9493c63fe07874bdab033ccb8847eca8d /libcxxabi/src/cxa_exception.cpp
parentff07af12df83c0112d702f61557bf9541584074f (diff)
downloadbcm5719-llvm-58926c9a9b539b62b954af1301c65b293d9b413e.tar.gz
bcm5719-llvm-58926c9a9b539b62b954af1301c65b293d9b413e.zip
Made some minor tweaks to __cxa_rethrow
llvm-svn: 146396
Diffstat (limited to 'libcxxabi/src/cxa_exception.cpp')
-rw-r--r--libcxxabi/src/cxa_exception.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/libcxxabi/src/cxa_exception.cpp b/libcxxabi/src/cxa_exception.cpp
index 9cf61a9aa5a..e717bc725ec 100644
--- a/libcxxabi/src/cxa_exception.cpp
+++ b/libcxxabi/src/cxa_exception.cpp
@@ -265,6 +265,7 @@ void __cxa_end_catch() {
__cxa_exception *current_exception = globals->caughtExceptions;
if (NULL != current_exception) {
+ // TODO: Handle foreign exceptions? How?
if (current_exception->handlerCount < 0) {
// The exception has been rethrown
if (0 == incrementHandlerCount(current_exception)) {
@@ -319,19 +320,22 @@ std::type_info * __cxa_current_exception_type() {
(in an implementation-defined way) as being rethrown.
* If the caughtExceptions stack is empty, it calls terminate()
(see [C++FDIS] [except.throw], 15.1.8).
-* It then returns to the handler that called it, which must call
- __cxa_end_catch(), perform any necessary cleanup, and finally
- call _Unwind_Resume() to continue unwinding.
+* It then calls _Unwind_Resume_or_Rethrow which should not return
+ (terminate if it does).
*/
extern LIBCXXABI_NORETURN void __cxa_rethrow() {
__cxa_eh_globals *globals = __cxa_get_globals();
- __cxa_exception *exception = exception_from_exception_object(globals->caughtExceptions );
+ __cxa_exception *exception = globals->caughtExceptions;
if (NULL == exception) // there's no current exception!
std::terminate ();
-// Mark the exception as being rethrown
- exception->handlerCount = -exception->handlerCount ; // TODO: Atomic
+// TODO: Handle foreign exceptions? How?
+
+// Mark the exception as being rethrown (reverse the effects of __cxa_begin_catch)
+ exception->handlerCount = -exception->handlerCount;
+ globals->uncaughtExceptions += 1;
+// __cxa_end_catch will remove this exception from the caughtExceptions stack if necessary
#if __arm__
(void) _Unwind_SjLj_Resume_or_Rethrow(&exception->unwindHeader);
OpenPOWER on IntegriCloud