forked from OSchip/llvm-project
Treat all exceptions except that the ones that this library throws as foreign. Even other C++ exceptions.
llvm-svn: 149518
This commit is contained in:
parent
6b8ef34f84
commit
8aa78517ab
|
@ -82,8 +82,8 @@ static void setDependentExceptionClass(_Unwind_Exception* unwind_exception) {
|
|||
|
||||
// Is it one of ours?
|
||||
static bool isOurExceptionClass(const _Unwind_Exception* unwind_exception) {
|
||||
return (unwind_exception->exception_class & get_language) ==
|
||||
(kOurExceptionClass & get_language);
|
||||
return (unwind_exception->exception_class & get_vendor_and_language) ==
|
||||
(kOurExceptionClass & get_vendor_and_language);
|
||||
}
|
||||
|
||||
static bool isDependentException(_Unwind_Exception* unwind_exception) {
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace __cxxabiv1 {
|
|||
|
||||
static const uint64_t kOurExceptionClass = 0x434C4E47432B2B00; // CLNGC++\0
|
||||
static const uint64_t kOurDependentExceptionClass = 0x434C4E47432B2B01; // CLNGC++\1
|
||||
static const uint64_t get_language = 0x00000000FFFFFF00; // mask for C++
|
||||
static const uint64_t get_vendor_and_language = 0xFFFFFFFFFFFFFF00; // mask for CLNGC++
|
||||
|
||||
struct __cxa_exception {
|
||||
#if __LP64__
|
||||
|
|
|
@ -37,8 +37,9 @@ static void default_terminate_handler()
|
|||
{
|
||||
_Unwind_Exception* unwind_exception =
|
||||
reinterpret_cast<_Unwind_Exception*>(exception_header + 1) - 1;
|
||||
bool native_exception = (unwind_exception->exception_class & get_language) ==
|
||||
(kOurExceptionClass & get_language);
|
||||
bool native_exception =
|
||||
(unwind_exception->exception_class & get_vendor_and_language) ==
|
||||
(kOurExceptionClass & get_vendor_and_language);
|
||||
if (native_exception)
|
||||
{
|
||||
void* thrown_object =
|
||||
|
@ -167,8 +168,9 @@ terminate() _NOEXCEPT
|
|||
{
|
||||
_Unwind_Exception* unwind_exception =
|
||||
reinterpret_cast<_Unwind_Exception*>(exception_header + 1) - 1;
|
||||
bool native_exception = (unwind_exception->exception_class & get_language) ==
|
||||
(kOurExceptionClass & get_language);
|
||||
bool native_exception =
|
||||
(unwind_exception->exception_class & get_vendor_and_language) ==
|
||||
(kOurExceptionClass & get_vendor_and_language);
|
||||
if (native_exception)
|
||||
{
|
||||
__cxa_exception* exception_header = (__cxa_exception*)(unwind_exception+1) - 1;
|
||||
|
|
|
@ -784,8 +784,8 @@ __gxx_personality_v0(int version, _Unwind_Action actions, uint64_t exceptionClas
|
|||
{
|
||||
if (version != 1 || unwind_exception == 0 || context == 0)
|
||||
return _URC_FATAL_PHASE1_ERROR;
|
||||
bool native_exception = (exceptionClass & get_language) ==
|
||||
(kOurExceptionClass & get_language);
|
||||
bool native_exception = (exceptionClass & get_vendor_and_language) ==
|
||||
(kOurExceptionClass & get_vendor_and_language);
|
||||
scan_results results;
|
||||
if (actions & _UA_SEARCH_PHASE)
|
||||
{
|
||||
|
@ -873,8 +873,9 @@ __cxa_call_unexpected(void* arg)
|
|||
if (unwind_exception == 0)
|
||||
call_terminate(false, unwind_exception);
|
||||
__cxa_begin_catch(unwind_exception);
|
||||
bool native_old_exception = (unwind_exception->exception_class & get_language) ==
|
||||
(kOurExceptionClass & get_language);
|
||||
bool native_old_exception =
|
||||
(unwind_exception->exception_class & get_vendor_and_language) ==
|
||||
(kOurExceptionClass & get_vendor_and_language);
|
||||
std::unexpected_handler u_handler;
|
||||
std::terminate_handler t_handler;
|
||||
__cxa_exception* old_exception_header = 0;
|
||||
|
@ -931,8 +932,8 @@ __cxa_call_unexpected(void* arg)
|
|||
// This shouldn't be able to happen!
|
||||
std::__terminate(t_handler);
|
||||
bool native_new_exception =
|
||||
(new_exception_header->unwindHeader.exception_class & get_language) ==
|
||||
(kOurExceptionClass & get_language);
|
||||
(new_exception_header->unwindHeader.exception_class & get_vendor_and_language) ==
|
||||
(kOurExceptionClass & get_vendor_and_language);
|
||||
void* adjustedPtr;
|
||||
if (native_new_exception && (new_exception_header != old_exception_header))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue