From 9d6e5efbd4b77747387b35a45d0c591126f7c08c Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sun, 8 May 2022 19:30:43 -0400 Subject: [PATCH 24/27] OS specific changes --- llvm/lib/Support/ErrorHandling.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp index 77c3a37475d0..f70f15f27da4 100644 --- a/llvm/lib/Support/ErrorHandling.cpp +++ b/llvm/lib/Support/ErrorHandling.cpp @@ -96,12 +96,7 @@ void llvm::report_fatal_error(std::string_view Reason, bool GenCrashDiag) { fmt::print(stderr, "LLVM ERROR: {}\n", Reason); } - // If we reached here, we are failing ungracefully. Run the interrupt handlers - // to make sure any special cleanups get done, in particular that we remove - // files registered with RemoveFileOnSignal. - sys::RunInterruptHandlers(); - - abort(); + exit(1); } void llvm::install_bad_alloc_error_handler(fatal_error_handler_t handler, @@ -138,9 +133,15 @@ void llvm::report_bad_alloc_error(const char *Reason, bool GenCrashDiag) { // an OOM to stderr and abort. const char *OOMMessage = "LLVM ERROR: out of memory\n"; const char *Newline = "\n"; +#ifdef _WIN32 + (void)!::_write(2, OOMMessage, strlen(OOMMessage)); + (void)!::_write(2, Reason, strlen(Reason)); + (void)!::_write(2, Newline, strlen(Newline)); +#else (void)!::write(2, OOMMessage, strlen(OOMMessage)); (void)!::write(2, Reason, strlen(Reason)); (void)!::write(2, Newline, strlen(Newline)); +#endif abort(); }