blob: ed58dacd75aff6264e1faa4e138952d69e8b4019 [file] [log] [blame]
James Kuszmaulcf324122023-01-14 14:07:17 -08001From ae08bb29b4d2a8ea15a4b82b909c0f4aee5e9060 Mon Sep 17 00:00:00 2001
2From: PJ Reiniger <pj.reiniger@gmail.com>
3Date: Sun, 8 May 2022 19:30:43 -0400
4Subject: [PATCH 23/28] OS-specific changes
5
6---
7 llvm/lib/Support/ErrorHandling.cpp | 13 +++++++------
8 1 file changed, 7 insertions(+), 6 deletions(-)
9
10diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp
11index bc08199a1..839819094 100644
12--- a/llvm/lib/Support/ErrorHandling.cpp
13+++ b/llvm/lib/Support/ErrorHandling.cpp
14@@ -96,12 +96,7 @@ void llvm::report_fatal_error(std::string_view Reason, bool GenCrashDiag) {
15 fmt::print(stderr, "LLVM ERROR: {}\n", Reason);
16 }
17
18- // If we reached here, we are failing ungracefully. Run the interrupt handlers
19- // to make sure any special cleanups get done, in particular that we remove
20- // files registered with RemoveFileOnSignal.
21- sys::RunInterruptHandlers();
22-
23- abort();
24+ exit(1);
25 }
26
27 void llvm::install_bad_alloc_error_handler(fatal_error_handler_t handler,
28@@ -138,9 +133,15 @@ void llvm::report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {
29 // an OOM to stderr and abort.
30 const char *OOMMessage = "LLVM ERROR: out of memory\n";
31 const char *Newline = "\n";
32+#ifdef _WIN32
33+ (void)!::_write(2, OOMMessage, strlen(OOMMessage));
34+ (void)!::_write(2, Reason, strlen(Reason));
35+ (void)!::_write(2, Newline, strlen(Newline));
36+#else
37 (void)!::write(2, OOMMessage, strlen(OOMMessage));
38 (void)!::write(2, Reason, strlen(Reason));
39 (void)!::write(2, Newline, strlen(Newline));
40+#endif
41 abort();
42 }
43