Partially revert r152770. That commit moved the default handlers to their own file. But it also did some refactoring. It is the latter that is being reverted. The refactoring had accidentally removed the required effect that the default unexpected_handler calls std::terminate(), which is a visible effect.
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@174532 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/src/cxa_default_handlers.cpp b/src/cxa_default_handlers.cpp
index 0fba79c..27ffb71 100644
--- a/src/cxa_default_handlers.cpp
+++ b/src/cxa_default_handlers.cpp
@@ -18,8 +18,10 @@
#include "cxa_exception.hpp"
#include "private_typeinfo.h"
+static const char* cause = "uncaught";
+
__attribute__((noreturn))
-static void default_handler(const char* cause)
+static void default_terminate_handler()
{
// If there might be an uncaught exception
using namespace __cxxabiv1;
@@ -74,17 +76,11 @@
abort_message("terminating");
}
-
-__attribute__((noreturn))
-static void default_terminate_handler()
-{
- default_handler("uncaught");
-}
-
__attribute__((noreturn))
static void default_unexpected_handler()
{
- default_handler("unexpected");
+ cause = "unexpected";
+ std::terminate();
}