diff options
author | Eli Friedman <efriedma@codeaurora.org> | 2018-04-17 01:00:14 +0300 |
---|---|---|
committer | Eli Friedman <efriedma@codeaurora.org> | 2018-04-17 01:00:14 +0300 |
commit | 17a47b915ab28f158dad485625c34db2bcc23821 (patch) | |
tree | 9545eb55e625473e287b7e6238c8d81213b5ab9c /libcxxabi/src/cxa_default_handlers.cpp | |
parent | aca6d0013c24a9909069942696ec3d0063b7a583 (diff) |
[libc++abi] Replace __sync_* functions with __libcpp_atomic_* functions.
This is basically part 2 of r313694.
It's a little unfortunate that I had to copy-paste atomic_support.h,
but I don't really see any alternative.
The refstring.h changes are the same as the libcxx changes in r313694.
llvm-svn: 330162
Diffstat (limited to 'libcxxabi/src/cxa_default_handlers.cpp')
-rw-r--r-- | libcxxabi/src/cxa_default_handlers.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libcxxabi/src/cxa_default_handlers.cpp b/libcxxabi/src/cxa_default_handlers.cpp index 8231139df6ec..0fa169f06405 100644 --- a/libcxxabi/src/cxa_default_handlers.cpp +++ b/libcxxabi/src/cxa_default_handlers.cpp @@ -18,6 +18,7 @@ #include "cxa_handlers.hpp" #include "cxa_exception.hpp" #include "private_typeinfo.h" +#include "include/atomic_support.h" #if !defined(LIBCXXABI_SILENT_TERMINATE) static const char* cause = "uncaught"; @@ -101,10 +102,6 @@ std::terminate_handler __cxa_terminate_handler = default_terminate_handler; _LIBCXXABI_DATA_VIS std::unexpected_handler __cxa_unexpected_handler = default_unexpected_handler; -// In the future these will become: -// std::atomic<std::terminate_handler> __cxa_terminate_handler(default_terminate_handler); -// std::atomic<std::unexpected_handler> __cxa_unexpected_handler(default_unexpected_handler); - namespace std { @@ -113,10 +110,8 @@ set_unexpected(unexpected_handler func) _NOEXCEPT { if (func == 0) func = default_unexpected_handler; - return __atomic_exchange_n(&__cxa_unexpected_handler, func, - __ATOMIC_ACQ_REL); -// Using of C++11 atomics this should be rewritten -// return __cxa_unexpected_handler.exchange(func, memory_order_acq_rel); + return __libcpp_atomic_exchange(&__cxa_unexpected_handler, func, + _AO_Acq_Rel); } terminate_handler @@ -124,10 +119,8 @@ set_terminate(terminate_handler func) _NOEXCEPT { if (func == 0) func = default_terminate_handler; - return __atomic_exchange_n(&__cxa_terminate_handler, func, - __ATOMIC_ACQ_REL); -// Using of C++11 atomics this should be rewritten -// return __cxa_terminate_handler.exchange(func, memory_order_acq_rel); + return __libcpp_atomic_exchange(&__cxa_terminate_handler, func, + _AO_Acq_Rel); } } |