mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 22:30:13 +00:00
[libc++abi][NFCI] Consistently group new_handler, unexpected_handler and terminate_handler
Previously, the definitions of __cxa_terminate_handler and __cxa_unexpected_handler (and their set_xxx_handler functions) were grouped together, but the definition of __cxa_new_handler wasn't. This commit simply moves those to the same file to treat all handlers consistently.
This commit is contained in:
parent
138dc27186
commit
6714e1ce3b
@ -5,7 +5,8 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// This file implements the default terminate_handler and unexpected_handler.
|
// This file implements the default terminate_handler, unexpected_handler and
|
||||||
|
// new_handler.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
@ -104,6 +105,8 @@ _LIBCPP_SAFE_STATIC std::terminate_handler __cxa_terminate_handler = default_ter
|
|||||||
_LIBCXXABI_DATA_VIS
|
_LIBCXXABI_DATA_VIS
|
||||||
_LIBCPP_SAFE_STATIC std::unexpected_handler __cxa_unexpected_handler = default_unexpected_handler;
|
_LIBCPP_SAFE_STATIC std::unexpected_handler __cxa_unexpected_handler = default_unexpected_handler;
|
||||||
|
|
||||||
|
std::new_handler __cxa_new_handler = 0;
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -125,4 +128,10 @@ set_terminate(terminate_handler func) noexcept
|
|||||||
_AO_Acq_Rel);
|
_AO_Acq_Rel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new_handler
|
||||||
|
set_new_handler(new_handler handler) noexcept
|
||||||
|
{
|
||||||
|
return __libcpp_atomic_exchange(&__cxa_new_handler, handler, _AO_Acq_Rel);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
// This file implements the functionality associated with the terminate_handler,
|
// This file implements the functionality associated with the terminate_handler,
|
||||||
// unexpected_handler, and new_handler.
|
// unexpected_handler, and new_handler.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@ -92,16 +92,6 @@ terminate() noexcept
|
|||||||
__terminate(get_terminate());
|
__terminate(get_terminate());
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
new_handler __cxa_new_handler = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_handler
|
|
||||||
set_new_handler(new_handler handler) noexcept
|
|
||||||
{
|
|
||||||
return __libcpp_atomic_exchange(&__cxa_new_handler, handler, _AO_Acq_Rel);
|
|
||||||
}
|
|
||||||
|
|
||||||
new_handler
|
new_handler
|
||||||
get_new_handler() noexcept
|
get_new_handler() noexcept
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user