Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2012-01-30 20:07:00 +0400
committerHoward Hinnant <hhinnant@apple.com>2012-01-30 20:07:00 +0400
commit47cb854818ed51d591f58552c6e681a2ad372bf8 (patch)
treeab46572dd15b0ed25ba7ba60bed03f0028e8c340 /libcxxabi/src/cxa_handlers.cpp
parent3f0d2384aa802af867541a6cf9ce29cc77be0019 (diff)
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
Diffstat (limited to 'libcxxabi/src/cxa_handlers.cpp')
-rw-r--r--libcxxabi/src/cxa_handlers.cpp40
1 files changed, 25 insertions, 15 deletions
diff --git a/libcxxabi/src/cxa_handlers.cpp b/libcxxabi/src/cxa_handlers.cpp
index 15fde24cd013..98f7c259b51b 100644
--- a/libcxxabi/src/cxa_handlers.cpp
+++ b/libcxxabi/src/cxa_handlers.cpp
@@ -37,24 +37,34 @@ static void default_terminate_handler()
{
_Unwind_Exception* unwind_exception =
reinterpret_cast<_Unwind_Exception*>(exception_header + 1) - 1;
- void* thrown_object =
- unwind_exception->exception_class == kOurDependentExceptionClass ?
- ((__cxa_dependent_exception*)exception_header)->primaryException :
- exception_header + 1;
- const __shim_type_info* thrown_type =
- static_cast<const __shim_type_info*>(exception_header->exceptionType);
- const __shim_type_info* catch_type =
- static_cast<const __shim_type_info*>(&typeid(exception));
- // If the uncaught exception can be caught with std::exception&
- if (catch_type->can_catch(thrown_type, thrown_object))
+ bool native_exception = (unwind_exception->exception_class & get_language) ==
+ (kOurExceptionClass & get_language);
+ if (native_exception)
{
- // Include the what() message from the exception
- const exception* e = static_cast<const exception*>(thrown_object);
- abort_message("terminating with %s exception: %s", cause, e->what());
+ void* thrown_object =
+ unwind_exception->exception_class == kOurDependentExceptionClass ?
+ ((__cxa_dependent_exception*)exception_header)->primaryException :
+ exception_header + 1;
+ const __shim_type_info* thrown_type =
+ static_cast<const __shim_type_info*>(exception_header->exceptionType);
+ const __shim_type_info* catch_type =
+ static_cast<const __shim_type_info*>(&typeid(exception));
+ // If the uncaught exception can be caught with std::exception&
+ if (catch_type->can_catch(thrown_type, thrown_object))
+ {
+ // Include the what() message from the exception
+ const exception* e = static_cast<const exception*>(thrown_object);
+ abort_message("terminating with %s exception of type %s: %s",
+ cause, thrown_type->name(), e->what());
+ }
+ else
+ // Else just note that we're terminating with an exception
+ abort_message("terminating with %s exception of type %s",
+ cause, thrown_type->name());
}
else
- // Else just note that we're terminating with an exception
- abort_message("terminating with %s exception", cause);
+ // Else we're terminating with a foreign exception
+ abort_message("terminating with %s foreign exception", cause);
}
}
// Else just note that we're terminating