blob: 14c0e10119d280d2984ed2eb6161d3eb7b29b5b9 [file] [log] [blame]
Howard Hinnante8fcf832011-12-07 21:16:40 +00001//===------------------------- cxa_handlers.cpp ---------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//
9// This file implements the functionality associated with the terminate_handler,
10// unexpected_handler, and new_handler.
11//===----------------------------------------------------------------------===//
12
Howard Hinnant0f80bb72012-03-19 16:20:34 +000013#ifndef _CXA_HANDLERS_H
14#define _CXA_HANDLERS_H
15
Saleem Abdulrasool46eb39a2016-09-23 21:36:24 +000016#include <__cxxabi_config.h>
17
Howard Hinnante8fcf832011-12-07 21:16:40 +000018#include <exception>
19
20namespace std
21{
22
Shoaib Meenai54227ae2017-03-01 03:55:57 +000023_LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN
Howard Hinnante8fcf832011-12-07 21:16:40 +000024void
25__unexpected(unexpected_handler func);
26
Shoaib Meenai54227ae2017-03-01 03:55:57 +000027_LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN
Howard Hinnante8fcf832011-12-07 21:16:40 +000028void
29__terminate(terminate_handler func) _NOEXCEPT;
30
31} // std
Howard Hinnant0f80bb72012-03-19 16:20:34 +000032
33extern "C"
34{
35
Saleem Abdulrasool46eb39a2016-09-23 21:36:24 +000036_LIBCXXABI_DATA_VIS extern void (*__cxa_terminate_handler)();
37_LIBCXXABI_DATA_VIS extern void (*__cxa_unexpected_handler)();
38_LIBCXXABI_DATA_VIS extern void (*__cxa_new_handler)();
Howard Hinnant0f80bb72012-03-19 16:20:34 +000039
Howard Hinnant4cfb63f2012-03-19 16:56:51 +000040/*
41
42 At some point in the future these three symbols will become
43 C++11 atomic variables:
44
45 extern std::atomic<std::terminate_handler> __cxa_terminate_handler;
46 extern std::atomic<std::unexpected_handler> __cxa_unexpected_handler;
47 extern std::atomic<std::new_handler> __cxa_new_handler;
48
49 This change will not impact their ABI. But it will allow for a
Howard Hinnant6d00fef2013-02-15 15:48:49 +000050 portable performance optimization.
Howard Hinnant4cfb63f2012-03-19 16:56:51 +000051
52*/
53
Howard Hinnant0f80bb72012-03-19 16:20:34 +000054} // extern "C"
55
56#endif // _CXA_HANDLERS_H