aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/lib/Support/CrashRecoveryContext.cpp
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/libs/llvm12/lib/Support/CrashRecoveryContext.cpp
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/Support/CrashRecoveryContext.cpp')
-rw-r--r--contrib/libs/llvm12/lib/Support/CrashRecoveryContext.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/contrib/libs/llvm12/lib/Support/CrashRecoveryContext.cpp b/contrib/libs/llvm12/lib/Support/CrashRecoveryContext.cpp
index 6c2529df51..3d3ca7f567 100644
--- a/contrib/libs/llvm12/lib/Support/CrashRecoveryContext.cpp
+++ b/contrib/libs/llvm12/lib/Support/CrashRecoveryContext.cpp
@@ -9,7 +9,7 @@
#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ExitCodes.h"
+#include "llvm/Support/ExitCodes.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/ThreadLocal.h"
@@ -95,13 +95,13 @@ static void uninstallExceptionOrSignalHandlers();
CrashRecoveryContextCleanup::~CrashRecoveryContextCleanup() {}
-CrashRecoveryContext::CrashRecoveryContext() {
- // On Windows, if abort() was previously triggered (and caught by a previous
- // CrashRecoveryContext) the Windows CRT removes our installed signal handler,
- // so we need to install it again.
- sys::DisableSystemDialogsOnCrash();
-}
-
+CrashRecoveryContext::CrashRecoveryContext() {
+ // On Windows, if abort() was previously triggered (and caught by a previous
+ // CrashRecoveryContext) the Windows CRT removes our installed signal handler,
+ // so we need to install it again.
+ sys::DisableSystemDialogsOnCrash();
+}
+
CrashRecoveryContext::~CrashRecoveryContext() {
// Reclaim registered resources.
CrashRecoveryContextCleanup *i = head;
@@ -375,10 +375,10 @@ static void CrashRecoverySignalHandler(int Signal) {
sigaddset(&SigMask, Signal);
sigprocmask(SIG_UNBLOCK, &SigMask, nullptr);
- // Return the same error code as if the program crashed, as mentioned in the
- // section "Exit Status for Commands":
- // https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html
- int RetCode = 128 + Signal;
+ // Return the same error code as if the program crashed, as mentioned in the
+ // section "Exit Status for Commands":
+ // https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html
+ int RetCode = 128 + Signal;
// Don't consider a broken pipe as a crash (see clang/lib/Driver/Driver.cpp)
if (Signal == SIGPIPE)
@@ -442,27 +442,27 @@ void CrashRecoveryContext::HandleExit(int RetCode) {
llvm_unreachable("Most likely setjmp wasn't called!");
}
-bool CrashRecoveryContext::throwIfCrash(int RetCode) {
-#if defined(_WIN32)
- // On Windows, the high bits are reserved for kernel return codes. Values
- // starting with 0x80000000 are reserved for "warnings"; values of 0xC0000000
- // and up are for "errors". In practice, both are interpreted as a
- // non-continuable signal.
- unsigned Code = ((unsigned)RetCode & 0xF0000000) >> 28;
- if (Code != 0xC && Code != 8)
- return false;
- ::RaiseException(RetCode, 0, 0, NULL);
-#else
- // On Unix, signals are represented by return codes of 128 or higher.
- // Exit code 128 is a reserved value and should not be raised as a signal.
- if (RetCode <= 128)
- return false;
- llvm::sys::unregisterHandlers();
- raise(RetCode - 128);
-#endif
- return true;
-}
-
+bool CrashRecoveryContext::throwIfCrash(int RetCode) {
+#if defined(_WIN32)
+ // On Windows, the high bits are reserved for kernel return codes. Values
+ // starting with 0x80000000 are reserved for "warnings"; values of 0xC0000000
+ // and up are for "errors". In practice, both are interpreted as a
+ // non-continuable signal.
+ unsigned Code = ((unsigned)RetCode & 0xF0000000) >> 28;
+ if (Code != 0xC && Code != 8)
+ return false;
+ ::RaiseException(RetCode, 0, 0, NULL);
+#else
+ // On Unix, signals are represented by return codes of 128 or higher.
+ // Exit code 128 is a reserved value and should not be raised as a signal.
+ if (RetCode <= 128)
+ return false;
+ llvm::sys::unregisterHandlers();
+ raise(RetCode - 128);
+#endif
+ return true;
+}
+
// FIXME: Portability.
static void setThreadBackgroundPriority() {
#ifdef __APPLE__