Skip to content

Commit f0e601c

Browse files
committed
Use __cxa_throw on clang64
1 parent 4af127a commit f0e601c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

objcxx_eh.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ typedef struct objc_object* id;
88
#include "objc/runtime.h"
99
#include "objc/objc-arc.h"
1010
#ifdef __MINGW32__
11-
#include <bits/atomic_word.h>
1211
#include "objc/objc-exception.h"
1312
#include "objc/hooks.h"
1413
#endif
@@ -542,7 +541,7 @@ namespace __cxxabiv1
542541
struct __cxa_refcounted_exception
543542
{
544543
// Manage this header.
545-
_Atomic_word referenceCount;
544+
int referenceCount;
546545
// __cxa_exception must be last, and no padding can be after it.
547546
__cxa_exception exc;
548547
};
@@ -559,6 +558,9 @@ void objc_exception_throw(id object)
559558
objc_retain(object);
560559
DEBUG_LOG("objc_exception_throw: Throwing 0x%x\n", *exc);
561560

561+
#ifdef _LIBCPP_VERSION
562+
__cxa_throw(exc, & __objc_id_type_info, eh_cleanup);
563+
#else
562564
__cxa_eh_globals *globals = __cxa_get_globals ();
563565
globals->uncaughtExceptions += 1;
564566
__cxa_refcounted_exception *header =
@@ -576,6 +578,7 @@ void objc_exception_throw(id object)
576578
}
577579
DEBUG_LOG("Throw returned %d\n",(int) err);
578580
abort();
581+
#endif
579582
}
580583

581584
OBJC_PUBLIC extern objc_uncaught_exception_handler objc_setUncaughtExceptionHandler(objc_uncaught_exception_handler handler)

0 commit comments

Comments
 (0)